mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #21565: multiprocessing: use contex-manager protocol for synchronization
primitives.
This commit is contained in:
parent
1691e35953
commit
a924fc7abc
9 changed files with 43 additions and 102 deletions
|
@ -59,9 +59,8 @@ class Connection(object):
|
|||
return True
|
||||
if timeout <= 0.0:
|
||||
return False
|
||||
self._in.not_empty.acquire()
|
||||
self._in.not_empty.wait(timeout)
|
||||
self._in.not_empty.release()
|
||||
with self._in.not_empty:
|
||||
self._in.not_empty.wait(timeout)
|
||||
return self._in.qsize() > 0
|
||||
|
||||
def close(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue