id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 13349,sregex not thread-safe when copied,wave@…,Eric Niebler,"The following code does fail about every other execution: {{{ #!c++ #include #include #include using namespace std; using namespace boost::xpressive; struct MyRegexContainer { boost::xpressive::sregex myPatterns[20]; MyRegexContainer() { myPatterns[0] = sregex::compile(""[-]?[0-9]+\\.[0-9]{2}""); for (int i =0; i < 20; i++) { myPatterns[i] = myPatterns[0]; } } void match(const std::string& wert, int index) const { if(!regex_match(wert, myPatterns[index])){ cout << ""Index "" << index << "" did not match value "" << wert << endl; } } }; namespace { void testSREGEXMultithreadedTASK() { static const MyRegexContainer a; for (int i = 0; i < 10000; ++i) { a.match(""33.00"", i%20); a.match(""1.11"", i%20); } } } int main() { #ifdef BOOST_DISABLE_THREADS cout << ""BOOST_DISABLE_THREADS == TRUE"" << wert << endl; #endif boost::thread_group tgroup; for (int i = 0; i < 100; ++i) { tgroup.create_thread(boost::bind(&testSREGEXMultithreadedTASK)); } tgroup.join_all(); return 0; } }}}",Bugs,new,To Be Determined,xpressive,Boost 1.64.0,Problem,,,