Subject: Re: [boost] [Boost.utility]
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-01-27 17:08:52


AMDG

Andrew Chinkoff wrote:
> *** BEGIN EXPLANATION ***
> Let us imagine that boost::call_once has approximately this implementation
> (in pseudo code):
>
> call_once(function foo)
> {
> if(!called)
> {
> Locker locker;
> if(!called)
> {
> called = true;
> foo(); (1)
> }
> }
> }
>

called = true; has to go /after/ the call to foo.

Otherwise, this works once you add in the magic needed to
prevent the compiler and the hardware from reordering operations.

In Christ,
Steven Watanabe