Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] safe portable static mutex initialization
From: Serge Skorokhodov (ucayalyfish_at_[hidden])
Date: 2012-04-19 05:28:13


Hi,

<skip>

> That depends on your compiler. In case 1, the mutex is constructed when
> "create_something" is first called. With gcc there is a command-line
> option (-fthreadsafe-statics) which ensures that this is done in a
> thread-safe manner, so you don't have 2 threads thinking they are
> "first". On many builds this is enabled by default, but the user can
> still disable it. I don't think MSVC has thread-safe statics before
> VC11, but I'm not sure. I don't know about other compilers.
>
> In case 2, if you call create_something() after main() has started then
> it should be fine, as the class static will be fully constructed before
> main.
>

Thanks alot.

-- 
The fish that is singing in Ucayali river...

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net