Boost logo

Boost :

Subject: [boost] Need second opions from some threading / object creation experts...
From: John Maddock (boost.regex_at_[hidden])
Date: 2011-05-15 05:52:08


Folks,

I'm looking at the code for singleton_pool, and I can't *quite* convince
myself that it's completely thread safe and guaranteed to do what it says,
the code in question is in boost/pool/detail/singleton.hpp which is a
deceptively clever/simple singleton implementation. I haven't been able to
break it in practice, but would a sufficiently clever compiler be able to
optimize away the call create_object.do_nothing(); and therefore not
instantiate the object prior to main()?

Thanks in advance, John.


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