Boost logo

Boost :

From: Lois Goldthwaite (loisg_at_[hidden])
Date: 2000-08-04 12:40:16


Even when threads aren't involved, you have to be very careful about static
initialization. The C++ standard places no requirements on the order in which
static objects from different translation units will be initialized. Better,
IMHO, is to document that the application has to call an initialization routine
before using any objects or starting any threads.

Lois

William Kempf wrote:

>
> I don't believe that pthread mutexes (muti?) are recursive. I'm also
> unaware of any problems specifically with critical sections being
> statically initialized under Win32. However, most "mutex"
> implementations are C based implementations that require two step
> creation that even when wrapped in a C++ object results in a race
> condition when attempted to be used in this manner. It would be
> possible to work around such limitations in our library, however. At
> least to the extent that the language will allow us to... but unless
> there's a language change then static initialization is problematic
> at best any way, since there's no gaurantee about the order or
> concurrency requirements of using static data with multiple threads.
>


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