Hello Eric!
On 1/12/2012 6:29 AM, Ovanes Markarian wrote:
> Hello *,
I prefer Eric, but hey. ;-)
Yep, I know the problem. I'm sorry to say that it's by design -- or
rather, that it's a known limitation of the way regex impls are
ref-counted and would be very hard to fix, if it can be fixed at all. At
least it's documented, but you'd have to read the docs very carefully.
See here:
http://www.boost.org/doc/libs/1_48_0/doc/html/xpressive/user_s_guide.html#boost_xpressive.user_s_guide.tips_n_tricks.create_grammars_on_a_single_thread
You're nesting regex objects; i.e., building a grammar. When you are
building a grammar, both the outer *and* inner regex objects are
modified. What is happening is that the sregex object (presumably) held
by parser_ is being mutated simultaneously from several threads. That's bad.
That link tells you that you need to build your grammars on a single
thread. I would create this regex once the same place where you build
the regex returned by parser_->delimiter(). Then use that regex instead
of constructing it at local scope over and over.
HTH,