"Peter Dimov" <> wrote in message
news:791c816b-dce9-4325-a231-...
On Aug 7, 2:09 pm, "Chris M. Thomasson" <n...@spam.invalid> wrote:
> > AFAICT, the release barrier in a user algorithm is in the wrong place.
> > The
> > load cannot be allowed to be hoisted up above the production of any item
> > in
> > a user container class. Basically, the production of an item into a user
> > container usually only requires a release barrier. Its in the wrong
> > place
> > wrt coupling the algorithm with my eventcount. A StoreLoad needs to be
> > there
> > in order to allow the production to be completely visible BEFORE the
> > load
> > from the eventcount is performed... Where am I going wrong?
> >
> > Read here for more info:
> >
> > http://groups.google.com/group/comp..../browse_frm/th...
> >
> > Humm...
> Hmmm.
> In terms of the C++MM, the options I see are:
> 1. store.seq_cst in push, load.seq_cst in signal, cas.seq_cst in get
> 2. fence.seq_cst+load.relaxed in signal, cas.relaxed+fence.seq_cst in
> get
> 3. RMW.seq_cst in signal, cas.seq_cst in get
> and maybe
> 4. RMW.acq_rel in signal, cas.acq_rel in get
For now, I choose number 2 because in the current eventcount algorithm
as-is, the `signal()' procedure needs a preceding StoreLoad, and the `get()'
function needs a trailing StoreLoad. AFAICT, this is fine... As for the
other choices, well, I don't like number 1 because it moves memory
visibility rules directly into an end-user algorithm. I dislike 3-4 because
of the dummy RMW; for instance, I could use a `seq_cst' fetch-and-add on the
eventcount state with an addend of zero. However, IMVHO, that looks like
fairly dirty hack indeed... I mean, IMVHO, a RMW which does not perform a
mutation is basically pointless...