
On 12/30/2011 02:48 PM, Beman Dawes wrote:
Class path locale initialization has suffered from a data race for several releases. See https://svn.boost.org/trac/boost/ticket/6320 for an example of code that suffers as a result.
The problem was introduced when locale initialization was changed from namespace scope initialization to function scope initialization. For Windows and Mac OS X, the fix is simply to change back to namespace scope initialization.
For non-BSD based POSIX systems such as Linux, the problem is more complex. These system need std::locale(""), "the locale-specific native environment".
From what you're saying, function-scope static initialization is only required on Linux. Then you say that the problem is that function-scope static initialization is not thread-safe. But function-scope static iniitalization is thread-safe with conforming C++11 compilers, and has been thread-safe with GCC and other compilers that follow the Itanium ABI for a fairly long time. So the problem seems to be non-existent.