Boost logo

Boost Users :

Subject: Re: [Boost-users] [xpressive] sporadic crashes in multi-threaded code
From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2012-01-14 03:52:35

Hello Eric!

On Sat, Jan 14, 2012 at 5:35 AM, Eric Niebler <eric_at_[hidden]> wrote:

> On 1/12/2012 6:29 AM, Ovanes Markarian wrote:
> > Hello *,
> I prefer Eric, but hey. ;-)
> I thought someone else could answer the question as well... So it was not
a special question for you ;) Because I know, that you spend considerable
amount of time to maintain all your libs, so asking you directly to answer
the post is a bit unpolite IMO ;) But many thanks for that answer.

> 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:
> 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,

Yes, this is what I did by using Nifty Counter, even static initialization
was not enough in my context, since there was some logger thread in a huge
fw which did "bad things" when main was left and cause the application
crash at exit.

Many thanks for your great answer and verification of my assumption.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at