Queue can result in nested monitor deadlock

Duncan Booth duncan.booth at invalid.invalid
Mon Apr 17 13:48:29 EDT 2006


Jonathan Amsterdam wrote:

> If you don't want to call it deadlock, fine, but the program execution
> I describe will make no progress to the end of time. Thread 2 can never
> put anything in the queue, because Thread 1 holds M, and Thread 1 will
> never release M because that can only happen if someone puts something
> on the queue.
> 
If your class is using a queue to handle the inter-thread communication why 
is it also using a semaphore?

If your methods are already locked so only one thread runs at a time why 
are you then using a queue to provide another layer of locking: a simple 
list should suffice?



More information about the Python-list mailing list