[cpp-threads] Failed compare-and-swap
Peter Dimov
pdimov at mmltd.net
Thu Aug 2 23:23:34 BST 2007
Lawrence Crowl wrote:
> On 8/2/07, Boehm, Hans <hans.boehm at hp.com> wrote:
>> Does it make sense to use an additional overload instead of a default
>> value, so that failure_order can effectively default to
>> success_order? I think that's clearly the correct default for
>>
>> seq_cst, relaxed, and release
>>
>> since release becomes vacuous in the failure case, since there is no
>> store.
>
> That could work, but we'd need three overloads.
Two are enough for that default.
compare_swap( int& e, int d, memory_order w, memory_order r );
compare_swap( int& e, int d, memory_order w = memory_order_seq_cst )
{
compare_swap( e, d, w, w );
}
The first overload can be made to strip release from r.
More information about the cpp-threads
mailing list