mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
Use context manager for a lock.
This commit is contained in:
parent
89dfbe35af
commit
4b7deed9a5
1 changed files with 1 additions and 4 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue