Boost logo

Boost :

Subject: Re: [boost] Boost sprint: #3407 boost::call_once not re-entrant (at least in win32)
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2009-11-25 03:32:02

Gottlob Frege <gottlobfrege_at_[hidden]> writes:

>> I've checked in a new version on trunk
>> It's not as tidy as I'd like, but I think the logic is sound.
> Probably, except you never actually wait on the event! :-)
> (or maybe I missed it).

Oops! I thought I'd put it at the end of the loop.

> Also, once_flag is no longer a POD (because of the destructor). Not
> sure if that is important. It is also now approx 4 * sizeof(long)
> instead of just sizeof(long or pointer). :-(

Lack of POD-ness is not important because it can still be statically
initialized. The increased size is unfortunate. You can probably get
away with packing the flags and counts into the same word at the expense
of having to use a CAS loop to update them (for the counts to exceed
even 16 bits would be highly unlikely).


Author of C++ Concurrency in Action
just::thread C++0x thread library   
Just Software Solutions Ltd
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

Boost list run by bdawes at, gregod at, cpdaniel at, john at