On Sun, Aug 28, 2011 at 6:55 PM, Jeffrey Walton <noloa...@gmail.com> wrote:
> On Sun, Aug 28, 2011 at 12:26 PM, Bart Van Assche <bvanass...@acm.org> wrote:
>> On Sun, Aug 28, 2011 at 6:13 PM, Jeffrey Walton <noloa...@gmail.com> wrote:
>>> (1) Never trust wikipedia.
>>
>> Reading your message makes me wonder whether you are familiar with the
>> reason why memory barriers exist,
>
> I'm not aware that GCC will change the semantics of the program under
> these conditions. I could be wrong, though.

What matters here is that without intervening memory barrier store
instructions executed by one CPU may be observed in the opposite order
by another CPU. This won't happen with x86 CPUs but can happen with
e.g. PowerPC and ARM CPUs. When implementing the double-checked
locking pattern, one has not only to be careful about instruction
reordering by the compiler but also about reordering by the memory
subsystem.

>> something the Wikipedia authors of
>> the page about double-checked locking clearly are aware of ?
>
> It does not change the fact that I do not trust wikipedia. I've found
> too many mistakes of the years.

:-)

Bart.

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to