PyThread_acquire_lock freezes at pthread_cond_wait although lock not occupied

Jeremy Hylton jeremy at alum.mit.edu
Thu Feb 6 13:18:09 EST 2003


Gernot Hillier <ghillie at suse.de> wrote in message news:<b1tqqs$q4e$1 at Fourier.suse.de>...

> pthread_cond_wait () was blocked but import_lock_level was 0 and 
> import_lock_thread was -1.
> 
> Anybody seen anything like this?
> 
> It occurs on GNU/Linux using pthreads from glibc 2.2.5. I'm using Python 
> 2.2.1 but can't see that 2.2.2 will improve this somehow...
> 
> This is very important for me as the program will get my diploma thesis and 
> if I couldn't get this problem solved in the next week, I'll get in real 
> trouble. :-((
> 
> So please, please if any of you has some idea which could be helpful, please 
> tell me!! TIA!!!

A condition variable that is waiting does not hold the lock.  You can
only call wait with the lock acquired, and the first thing wait does
is release the lock.
So there shouldn't be any surprise that you are blocked in wait
without holding
the lock.

If you have a multi-threaded application, you should look at what all
the other threads are doing.  One of the other threads has the lock
and hasn't released
it.  There's a good chance that there is inconsistent use of app-level
locking
with the GIL.

Jeremy




More information about the Python-list mailing list