Boost logo

Boost Users :

From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2005-01-26 15:14:36

Leon Mergen wrote:
> Hello,
> I am sorry if this is a stupid question, or simply inappropriatie for
> this list. I am currently camping with this bug for way too long, so I
> decided to ask this mailinglist.
> I am currently in the process of finding out where a segfault is, and
> how to fix it. Now, I am using the boost regex library to parse my
> regexes, and for some reason when multiple threads use this regex
> library, it seems to mess up and generate segfaults (it works perfectly
> with only one thread). Since it also doesn't always occur on the same
> place, and doesn't even occur /all/ the times, I have a strong feeling
> this has something to do with thread safety.
> On the Boost website is was able to find out that the boost regex
> library should be thread safe when BOOST_HAS_THREADS is defined; I've
> tested this, and this worked.
> ( )
> However, I also was able to find a mailinglist message that provides
> some instructions on how to make certain boost regex functions
> thread-safe :
> ( )

That is not specifically about thread-safety in Boost.Regex; the
initialisation of local static variables is generally not done in a
thread-safe way even by implementations that are intended to support
multithreaded programs, and this goes for variables of any type.

I can tell you for certain, though, that std::string is not thread-safe
in libstdc++ (see <>).
  That might be the source of the problem.


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