
Le 13/01/13 16:16, Andrey Semashev a écrit :
once_flag must always be statically initialized, that's the key feature that allows call_once to be thread-safe. In C++03 this can only be guaranteed for POD types. C++11 also includes constant initialization into static initialization (i.e. when objects are initialized with constexpr constructors). All other objects are initialized during dynamic initialization, which is not thread-safe.
Thanks for clarifications, I understand your concern. The non-POD once_flag implementation can not be used for static once_flag instances in a thread safe mode. Just for curiosity, from where comes the restriction that once_flag must always be statically initialized? Could you point me to the standard? Best, Vicente