[Insight-developers] Thread safety and STL containers

Joshua Cates cates@cs.utah.edu
Wed, 28 Nov 2001 10:00:42 -0700 (MST)


Hi Bill,

This is great news!  Thanks for tracking it down.

Josh.

______________________________
 Josh Cates			
 School of Computer Science	
 University of Utah
 Email: cates@cs.utah.edu
 Phone: (801) 587-7697
 URL:   www.cs.utk.edu/~cates


On Wed, 28 Nov 2001, Lorensen, William E (CRD) wrote:

> Folks,
> I've been trying to track down intermittent crashes in some itk tests. The crashes occurred on both
> solaris and sgi.
> itkCurvatureFlowTest would crash occasionally on multi processors. I tracked the problem dowm to the
> ThreadedCalculateChange method in Common/itkDenseFiniteDifferenceImageFilter. It seemed that the
> faceList (implemented with the STL list container) was geeting corrupted.
>  
> To make a long story (and long day) short, I searched google with
> gnu stl thread safe
> which led me to:
> http://www.sgi.com/tech/stl/thread_safety.html <http://www.sgi.com/tech/stl/thread_safety.html> 
>  
> I fixed "the problem" by putting a lock around the push_back method on the list.
>  
> So... beware of STL usage in threaded code.
>  
> Bill
>  
>  
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>