Use context manager for a lock.

This commit is contained in:
Brett Cannon 2008-02-03 02:43:01 +00:00
parent 89dfbe35af
commit 4b7deed9a5

View file

@ -142,11 +142,8 @@ def worker(self, q):
if x is None:
q.task_done()
return
self.cumlock.acquire()
try:
with self.cumlock:
self.cum += x
finally:
self.cumlock.release()
q.task_done()
def queue_join_test(self, q):