RE: [Linux-ia64] Re: pthread_mutex_lock sometimes fails on Linux 2.4.5

From: Luck, Tony <>
Date: 2001-06-28 10:18:43
This sounds similar to a problem that I saw a few weeks
ago.  In my case threads would spin for an inordinate
amount of time in __pthread_lock() because re-reading of
the __status field was optimised out of the loop (it isn't
declared as volatile).  Newer versions of glibc (2.2.2 IIRC)
have some __asm() magic in the loop to force the re-read (the
glibc folks didn't want to make the __status field volatile
because of lots of other pointer casting changes that would
have been needed).

See if a newer glibc helps with your problem too.

-Tony Luck

-----Original Message-----
I slightly misstated the problem.  Here is what actually happens:
Four threads have entered a barrier (my own C code).  Within the barrier,
they call pthread_mutex_lock and increment a counter while holding the lock.
Three threads are waiting on the counter, whose value is three, to go to
four.  The fourth CPU is looping in the kernel in cpu_idle.  I don't know
how it got there, but probably it has something to do with calling
Received on Wed Jun 27 17:18:55 2001

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:04 EST