Subject: infinite loop in pthread__mutex_spin after call to exit
To: None <> From: Sverre Froyen <> List: current-users Date:
12/28/2007 17:18:12  I've been attempting to debug why the
program /usr/pkg/qt4/bin/qdbus hangs  after its call to exit and
I've ended up with a case where the C code, the  assembler, and
the variable values all look OK, yet the program hangs,  looping
in the method pthread__mutex_spin in
src/lib/libpthread/pthread_mutex2.c (1.17).  The code that
appears to fail is the test                  if
(thread->pt_lwpctl->lc_curcpu == LWPCTL_CPU_NONE ||  which if
true would have exited the loop.  LWPCTL_CPU_NONE is defined as
(-1) and gdb shows that  thread->pt_lwpctl->lc_curcpu is also -1
at each iteration through the loop  but the test (apppears to)
evaluate to false.  The assembly code for the pertinent part of
the test reads (when compiled  without optimization):
0xbbb55535 <pthread__mutex_spin+21>:    mov    0xc(%esp),%eax
0xbbb55539 <pthread__mutex_spin+25>:    mov    0x184(%eax),%eax
0