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.
Best regards, Peter.