Regression test for thread safety?

Dan Kegel dkegel@ixiacom.com
Mon Jul 15 14:18:00 GMT 2002


Phil Edwards wrote:
> On Sun, Jul 14, 2002 at 01:51:39PM -0700, Dan Kegel wrote:
> 
>>I did some experiments to measure how effective these tests are
>>at detecting thread safety problems.  First, I tested whether
>>compiling with -D_NOTHREADS disabled locking.  As expected,
>>  g++-3.0 -E t.C | grep -i __lock_instance
>>showed hits,  but adding -D_NOTHREADS showed no hits.
> 
> 
> Something you should know if you haven't discovered it since your email:
> turning thread support on and off is only supported by the command-line flags
> like "-pthread" or "-mthreads" or whatever is appropriate for your platform.
> Preprocessor symbol hacks like _NOTHREADS were never documented and aren't
> really supported.

Certainly.  However, turning on _NOTHREADS does exactly what I want
at the moment: it defeats locking.  (Kids, don't try this at home
unless you've done your homework.)
- Dan




More information about the Libstdc++ mailing list