Queue can result in nested monitor deadlock
Jack Diederich
jack at performancedrivers.com
Mon Apr 17 12:58:51 EDT 2006
On Mon, Apr 17, 2006 at 09:41:37AM -0700, 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.
>
Right, the problem isn't with Queue it is with your global lock M.
Here is the pseudo code for your program:
acquire_lock("No_one_else_can_do_anything")
wait_for_someone_else_to_do_something() # waits forever
-Jack
More information about the Python-list
mailing list