Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-10-03 11:21:46


p.klotz_at_[hidden] wrote:
>> A simple multithreaded application using 100 threads where each
>> thread executes the following loop results in exceptions thrown by
>> the boost::regex() constructor:
>>
>> for (int i=0;i<1000;++i) boost::regex("[a-z]{1}");
>>
>> The exceptions thrown are either "Invalid content of repeat range" or
>> "Unmatched { or \{".
>>
>> Since the regular expression used is valid and does not throw when
>> executed in a single threaded environment I expect some static
>> variable to be used by BoostRegex internally.
>>
>> Should BoostRegex be threadsafe?
>>
>> We use Red Hat Enterprise Linux 3 (gcc 3.2.3) as our development
>> platform.
>>
>> Remark: The problem disappears when the curly braces are escaped by
>> \\ or when using a "std::string" instead of a "const char*" argument.
>>

Yes it's a known issue, please see:
http://archives.free.net.ph/message/20060801.091156.a4824897.en.html
for the fix.

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net