[cpp-threads] Yet another visibility question

Ben Hutchings ben at decadent.org.uk
Sat Dec 30 11:40:03 GMT 2006


On Thu, 2006-12-28 at 07:52 -0500, Raul Silvera wrote:
<snip>
> What I am proposing, then, is:
> 
> // x y initially zero
> 
> // threads 1 to N:
> 
> assert( x == 0 );
> 
> if( fetchadd_release( &y, 1 ) == N - 1 )
> {
>     acquire_fence(); // prevent subsequent stores to x from moving before any previous loads
>     x = 1;
> }
> 
> Note that a explicit fence is something easy for the compiler to handle.
<snip>

Associating an acquire barrier with an operation means that subsequent
operations can't be moved before it (but earlier operations can be moved
after it).  An acquire barrier on its own is meaningless and is
certainly not equivalent to a store-load barrier.

Ben.

-- 
Ben Hutchings
For every action, there is an equal and opposite criticism. - Harrison
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.decadentplace.org.uk/pipermail/cpp-threads/attachments/20061230/afbe3d5a/attachment-0001.pgp


More information about the cpp-threads mailing list