
The problem only shows up on my dual-processor G5, and never seemed to happen on single-processor systems, so we have some kind of race condition. Looking more carefully at the Spirit source, I see this:
#ifdef BOOST_SPIRIT_THREADSAFE static boost::mutex mutex; boost::mutex::scoped_lock lock(mutex); #endif
I don't think that's valid, because two threads could try to initialize the static at the same time. We'd need to do some other kind of locking in here, then create the mutex on the heap.
Right that code absolutely will create a race condition in the mutex initialisation. If it helps any regex has a static_mutex class that is initialised with a static initialiser list (so no race condition), I've been meaning to polish this off as a formal submission, but in the mean time the code is here: boost/regex/pending/static_mutex.hpp. John.