
18 Nov
2010
18 Nov
'10
5:40 p.m.
On Wed, Nov 17, 2010 at 11:13 PM, Gottlob Frege
Any flaws with this approach?
Yes.
Your thread will see flag correctly, but the "important data" being protected/initted by the once, might not bee seen correctly.
<snip nice long explanation> Another way to say it is that you are essentially trying to do the classic "double-checked locking" (DCL) pattern, which is well-known not to work and you can find plenty of explanations for. In fact, the BOOST_THREAD_ONCE* stuff is there to solve exactly that problem. -- Dave Abrahams BoostPro Computing http://www.boostpro.com