[cpp-threads] pthreads (was: RE: C++ Connections proposal)

Alexander Terekhov alexander.terekhov at gmail.com
Tue Apr 26 13:52:33 BST 2005


On 4/26/05, Peter Dimov <pdimov at mmltd.net> wrote:
> Alexander Terekhov wrote:
> > On 4/26/05, Peter Dimov <pdimov at mmltd.net> wrote:
> > [...]
> >> lock-free code doesn't use non-competing accesses.
> >
> > It can (in addition to competing accesses).
> >
> > http://www.decadentplace.org.uk/pipermail/cpp-threads_decadentplace.org.uk/2005-April/000229.html
> >
> > ----
> >   void producer(const T & value) {
> >     ELEM * tail = m_tail.load(msync::naked_noncompeting);
> 
> Yes, but it uses them in contexts where compiler reorderings, value
> propagation and even word tearing/piecewise loads do not matter, right? So
> the atomic<> wrapper aside, the above is just
> 
>    ELEM * tail = m_tail;

IFF the language does indeed prohibit transforming it to something a la 

ELEM * tail = ++m_tail, --m_tail; // "as if" m_tail, compiler is just
nastily legal

m_tail.load(msync::naked_noncompeting) would certainly not allow that. 

> and places no restrictions on the compiler.

ELEM * tail = m_tail; is (currently) open to interpretation in this respect. 

Oder?

regards,
alexander.




More information about the cpp-threads mailing list