Boost logo

Boost :

Subject: [boost] [filesystem] thread safety on msvc 2010
From: Jacob Schloss (jacob.schloss_at_[hidden])
Date: 2013-01-27 19:50:29


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.

I'd appreciate any thoughts, or pointers if anyone has worked on this
issue, I saw some discussion at
http://lists.boost.org/Archives/boost/2011/12/189183.php but it did not
seem to move forwards.

Thanks,
Jacob Schloss


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk