http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51249
--- Comment #3 from Alan Modra <amodra at gmail dot com> 2011-11-21 22:21:13 UTC --- Sorry, I misread the code. Indeed, the mutex will be left at 2. I'm chasing a frustratingly elusive locking bug. Symptoms are that one or two libgomp tests fail each gcc testsuite run, not always the same test. log shows a timeout, but I'm fairly certain it isn't a real timeout but one of the threads blocking. This used to happen before rth's recent locking changes. The difficulty is that I can't seem to reproduce the failure when running tests by hand. I have a rewrite of sem.c,h which adds a "wait" field to the struct and uses atomics, and have rewritten a number of other files to use atomics rather than the old __sync functions. I just haven't been game to post my changes until I track down the problem.