
Sure. Here's a very simple program that does nothing useful, but which crashes consistently on a multi-processor machine. Kind regards, Alistair #include <boost/regex.hpp> #include <iostream> #include <string> #include <pthread.h> const char* const reExpr("abcd(.*)"); const char* const replaceExpr("$1"); boost::regex re(reExpr); size_t noThreads(50); pthread_barrier_t barrier; extern "C" { void* test_fn(void*) { pthread_barrier_wait(&barrier); while(1) { std::string expr("abcdefgh"); std::cout << boost::regex_replace(expr, re, replaceExpr, boost::match_default|boost::format_all) << std::endl; } return 0; } } int main(int argc,char* argv[]) { pthread_t* threads = new pthread_t[noThreads]; pthread_barrier_init(&barrier, NULL, noThreads); size_t i = 0; for (; i < noThreads; ++i) { if(pthread_create(&(threads[i]), NULL, test_fn, NULL)) { std::cerr << "Error creating thread" << std::endl; return 1; } } for(i = 0; i < noThreads; ++i) pthread_join(threads[i], NULL); exit(0); } -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of John Maddock Sent: 11 July 2006 10:02 To: boost-users@lists.boost.org Subject: Re: [Boost-users] Seg faults when using boost::regex_replaceinmultiple threads mailinglist@kamba.net.nz wrote:
Does anyone know if there is a known problem with using these new versions of boost::regex_replace in multiple threads? If it's helpful, I have a very simple test program that demonstrates the problem. Any help on this would be greatly appreciated.
If you can let me have the test program I can at least try and reproduce it. I must admit to being at a loss to explain this otherwise: there really is no thread sensitive code inside regex_replace. John. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users