[cpp-threads] modes, pass 2

Peter Dimov pdimov at mmltd.net
Mon May 9 18:48:10 BST 2005


Alexander Terekhov wrote:
> I think that the trick can be used for your get_acquire().

Yep. In "compilable pseudocode":

template<class T, class M> T atomic_load( M msync, T * addr )
{
    if( msync & msync_ssb )
    {
        _sync();
    }
    else if( msync & msync_slb )
    {
        _lwsync();
    }

    T r = _load( addr );

    if( msync & msync_acq )
    {
        _inject_conditional_branch();
    }

    if( msync & msync_hlb )
    {
        _isync();
    }

    return r;
}





More information about the cpp-threads mailing list