[cpp-threads] modes, pass 2

Peter Dimov pdimov at mmltd.net
Mon May 9 11:31:43 BST 2005


Alexander Terekhov wrote:
> On 5/8/05, Peter Dimov <pdimov at mmltd.net> wrote:
> [...]
>> Infallible CAS: do { if( LL() != old ) return false; } while(
>> !SC(new) ); return true;
>> Fallible CAS: return LL() == old && SC(new);
> 
> I'd rather expose (compile time feature testing required) LL/LR and
> SC.

CAS( addr, old, new ):

    if( LL(addr) != old ) return fail-not-old;
    if( !SC(addr, new) ) return fail-store;
    return success;

covers both. It's still not the same as exposed LL/SC, of course.




More information about the cpp-threads mailing list