whirm/tgs-pc — Issue #7: Using locks...
Author: rauljim
Created: 2012-03-05 12:59:26+00:00
State: open

I just skimmed through chat-demo.py.

One must handle locks carefully. I see potential disaster in the making.

For instance, in lines 137-155. Why is the lock acquired twice? Why is the lock deleted (line 155)?

Also, when using locks, it's very useful to use the with statement to avoid deadlocks. With is available in Python from 2.5.