Boost logo

Boost :

Subject: Re: [boost] Thread-safe singleton pattern
From: Helge Bahmann (hcb_at_[hidden])
Date: 2010-01-26 07:30:14


On Mon, 25 Jan 2010, Alex Miller wrote:

> Your implementation seems to be a fairly standard implementation of double
> checked locking, and thus is likely vulnerable to the issues outlined in C++
> and the Perils of Double-Checked
> Locking<http://www.aristeia.com/Papers/DDJ_Jul_Aug_2004_revised.pdf>
> .

yes, the implementation is broken; see e.g.

http://www.chaoticmind.net/~hcb/projects/boost.atomic/doc/atomic/usage_examples.html#boost_atomic.usage_examples.singleton

for a correct one, using Boost.Atomic


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