This is the mail archive of the
mailing list for the GCC project.
Re: More on memory barriers
On Wed, 15 Sep 2004 13:35:59 -0500, Benjamin Kosnik <email@example.com> wrote:
> I would have thought that the Double Checked Lock would be written much
> like the code you posted Jason. This idiom is appearing more and more
> often in libstdc++ (currently sans the mb parts!) so I would very much
> like to achieve consensus on the right way to do this.
The general consensus seems to be "Don't".
Unfortunately, ABI issues make it very difficult to use something
preexisting like pthread_once for static local initialization, but I would
strongly advise you to reconsider any other uses of DCLP in libstdc++.
Instead, you should be able to just use a static local variable, once these
issues are worked out.