Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2004-04-27 05:37:16


Howard Hinnant wrote:
[...]
> > http://www.pdimov.com/cpp/shared_count_x86_exp2.hpp
>
> Somehow I think I knew this and had just completely forgotten about it
> (I actually already had your proof of concept implementation
> bookmarked). Thanks for the reminder!

You're also doing PPC, right? WinXX's InterlockedIncrement,
InterlockedDecrement, and InterlockedCompareExchange are fully
fenced (bidirectional "full stop" barrier for loads and stores
imposed on both compiler and hardware). You can do better than
that. http://google.com/groups?selm=3F17EF6F.97295E7D%40web.de

decrement() shall have the effect of release memory sync
operation if the resulting value of a reference count is not
zero; otherwise, this function shall have the effect of
acquire memory synchronization operation. For compiler that
still means "full stop" but not so for hardware (or whoever
does runtime reodering). increment() doesn't impose any
reordering constraints. decrement(msync::acq{, ...}) shall
have the effect of acquire memory sync operation if the
resulting value of a reference count is zero; otherwise, the
memory synchronization effect of this function is unspecified.
decrement(msync::rel{, ...}) shall have the effect of release
memory synchronization operation if the resulting value of a
reference count is not zero; otherwise, the memory sync effect
of this function is unspecified.

regards,
alexander.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk