[cpp-threads] pthreads (was: RE: C++ Connections proposal)
Peter Dimov
pdimov at mmltd.net
Tue Apr 26 14:13:22 BST 2005
Alexander Terekhov wrote:
> 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
Pretty evil. This is, I believe, an illegal transformation in this
particular case, but one needs to resort to very arcane language lawyering
to support that claim, and it's possible to argue the matter for years
without a definite conclusion.
More information about the cpp-threads
mailing list