[cpp-threads] A question about N2153

Alexander Terekhov alexander.terekhov at gmail.com
Wed Jan 17 21:40:04 GMT 2007


On 1/17/07, Paul E. McKenney <paulmck at linux.vnet.ibm.com> wrote:
[...]
> > Well, an acquire_"fence" is like this:
> >
> > // do your atomic operation here
> > #StoreLoad | #StoreStore
> >
> > And a release_"fence" is like this:
> >
> > #LoadStore | #StoreStore
> > // do your atomic operation here
>
> OK.  But I already understood what you guys meant by these two primitives.
> My question is why choose these particular definitions?  From my
> viewpoint, the definitions are quite strange, and they don't do what I
> want in many cases.  I often need a StoreStore without the StoreLoad, and

Acquire "fence" and sink-store barrier part of .rel aside for a
moment, N2153 gives an example for "release" fence:

  do_work(A,B);
  release_fence();
  lock_A.store_raw(LOCK_UNLOCKED);
  lock_B.store_raw(LOCK_UNLOCKED);

I mentally translate it to

  do_work(A,B);
  atomic_stores_raw_group_release(lock_A, lock_B, LOCK_UNLOCKED);

(with an extra feature being that the later won't inhibit hoisting of
subsequent stuff above it any more than classic .rel).

regards,
alexander.



More information about the cpp-threads mailing list