On 20/04/12 14:41, Dave Abrahams wrote:
on Fri Apr 20 2012, Will Mason
wrote: On Fri, Apr 20, 2012 at 8:04 AM, Juan RamÃrez
wrote: But the initialization of static variables declared inside a function is not guaranteed to be thread safe. So you could easily end up calling it's constructor twice. That's something that boost::call_once is good at preventing.
Correct, for C++03. I could be mis-remembering but IIRC in C++11 function-local static variables have been given automatic threadsafe initialization.
You are right: this is guaranteed in C++11. Anthony -- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++11 thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976