[cpp-threads] Yet another visibility question

Peter Dimov pdimov at mmltd.net
Tue Nov 21 19:49:26 GMT 2006


Lawrence Crowl wrote:
> On 11/20/06, Hans Boehm <Hans.Boehm at hp.com> wrote:

>> I don't really agree with Lawrence that this is unusable.  The rules
>> are fairly clear, and we all agree that non-wizards should use
>> fetchadd_full here anyway.
> 
> I fail to see the use of fetch_add_release if it does not release its
> writes to all subsequent readers.  If the behavior of a third thread
> can prevent two threads from communicating, we have a problem.

Thanks for stating my point better than me! Here's another example:

// x y initially zero

// thread 1

x = 1;
store_release( &y, 1 );

// thread 2

fetchadd_release( &y, 0 ); // or raw

// thread 3

if( load_acquire( &y ) == 1 )
{
    assert( x == 1 );
}




More information about the cpp-threads mailing list