diff options
author | Charles-François Natali <cf.natali@gmail.com> | 2014-05-25 14:12:12 +0100 |
---|---|---|
committer | Charles-François Natali <cf.natali@gmail.com> | 2014-05-25 14:12:12 +0100 |
commit | a924fc7abc2d8788a4a9fa2cbef2caa5c5992ebd (patch) | |
tree | cb29ab708c0a0c1f8ea51d20cdc7dbdd19a77046 /Lib/multiprocessing/dummy/connection.py | |
parent | 1691e35953858ae06b5198bf12c72a6cd0e0234b (diff) | |
download | cpython-a924fc7abc2d8788a4a9fa2cbef2caa5c5992ebd.tar.gz cpython-a924fc7abc2d8788a4a9fa2cbef2caa5c5992ebd.zip |
Issue #21565: multiprocessing: use contex-manager protocol for synchronization
primitives.
Diffstat (limited to 'Lib/multiprocessing/dummy/connection.py')
-rw-r--r-- | Lib/multiprocessing/dummy/connection.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/multiprocessing/dummy/connection.py b/Lib/multiprocessing/dummy/connection.py index 694ef962150..19843751c0c 100644 --- a/Lib/multiprocessing/dummy/connection.py +++ b/Lib/multiprocessing/dummy/connection.py @@ -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): |