[Insight-developers] _GLIBCXX_DEBUG is not thread safe.

Hans Johnson hans-johnson at uiowa.edu
Thu Mar 27 10:30:27 EDT 2008


Hello,     

I wanted to get this information out on the developer list so that others
would see it.

_GLIBCXX_DEBUG  does not seem to be thread safe.

Code consistently in the pthread mutex lock when using "-g -D_GLIBCXX_DEBUG"
at line 302 of InsightToolkit/Algorithms/itkFastMarchingImageFilter.txx
=====================
299   while ( !m_TrialHeap.empty() )
300     {
301     // get the node with the smallest value
302     node = m_TrialHeap.top();
303     m_TrialHeap.pop();
=====================
 -- AND --
At line 141 of InsightToolkit/BasicFilters/itkMedianImageFilter.txx
=====================
139       // get the median value
140       const typename std::vector<InputPixelType>::iterator
                       medianIterator = pixels.begin() + medianPosition;
141       std::nth_element(pixels.begin(), medianIterator, pixels.end());
142       it.Set( static_cast<typename OutputImageType::PixelType>
                        (*medianIterator) );
=====================
_L_mutex_unlock_153,  FP=bfffd3c8


This problem occurs on the following platforms:

Darwin-c++-4.­0-dbg "-bind_at_load -g -UNDEBUG -Wall -D_GLIBCXX_DEBUG
-D_GLIBCXX_DEBUG_PEDANTIC -Wcast-qual"

Linux-g++-3.­4-prf "-fprofile-arcs -ftest-coverage -Wl,-E -g -UNDEBUG -Wall
-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -Wcast-qual"

Linux-gcc4-4.­1-dbg "-g -UNDEBUG  -Wall -D_GLIBCXX_DEBUG
-D_GLIBCXX_DEBUG_PEDANTIC -Wcast-qual -fmessage-length=512"

====================================================
This was reported by our good friend mathieu.malaterre last June on a
different list:
http://www.archivum.info/gnu.g++.help/2007-06/msg00002.html

Regards,
Hans
-- 
Hans J. Johnson, Ph.D.
Hans-johnson at uiowa.edu

278 GH
The University of Iowa
Iowa City, IA 52241
(319) 353 8587



More information about the Insight-developers mailing list