
On 5 March 2013 12:31, Vicente J. Botet Escriba wrote:
Le 22/02/13 23:49, Andrey Semashev a écrit :
Hi, Vicente!
I see you applied my patch for call_once but you seem to forgot to disable the C++11 call_once interface when the compiler does not support constexpr. Was that intentional or you just missed it?
Anyway, please find the patch attached.
Hi Andrey,
In your patch you say
+// For C++11 call_once interface the compiler MUST support constexpr. +// Otherwise once_flag would be initialized during dynamic initialization stage, which is not thread-safe.
I'm not an expert on the C++11 wording. Could you elaborate why once_flag would be initialized during dynamic initialization stage?
A non-constexpr constructor is a function call, which cannot happen during static initialization.