
On Sun, Jan 27, 2013 at 7:50 PM, Jacob Schloss <jacob.schloss@urbanrobotics.net> wrote:
Hi,
I've been having some crashes in my code due to concurrent creation of boost::filesystem::path objects on several threads.
The issue in short looks like function member static variable initialization is not thread safe in msvc 2010, but is in GCC. The main issue is with the construction of the std::locale and codecvt objects, I get crashes when some threads try to use a partially constructed instance of std::locale.
I posted some details of my issue and possible fix at the end of bug 6320 https://svn.boost.org/trac/boost/ticket/6320, and would like to clean it up into a patch for consideration. Right now, I was looking at using boost::thread call_once to synchronize the std::locale and codecvt initialization code. I'm running locally with a boost::thread::call_once patch, and it seems to work for some simple test cases.
Some critical points to getting a patch accepted are that it applies only to the affected platform (i.e. Windows) and that it includes test cases that fail with the current code but pass with the patch applied. If it works for you with msvc 2010, I can test with other versions and compilers. Thanks, --Beman