Boost logo

Boost Users :

From: Leon Mergen (leon_at_[hidden])
Date: 2005-01-27 05:11:45


On Wed, Jan 26, 2005 at 08:14:36PM +0000, Ben Hutchings wrote:
> 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.

Hi Ben,

Ok, I've now completely put both functions in a boost::mutex scoped lock
and it doesn't generate any segmentation faults anymore; so basically,
it works now.

For some reason I have the feeling this whole problem could be solved
*much* more elegant, but since I have a deadline in 1.5 weeks I think
this will do for now... I have found this page explaining in detail why
the initialisation is thread-unsafe, in case anyone is interrested:

http://weblogs.asp.net/oldnewthing/archive/2004/03/08/85901.aspx
 
Thanks for your help,

Leon Mergen


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