aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Quinlan <brian@sweetapp.com>2014-02-01 11:49:04 +1100
committerBrian Quinlan <brian@sweetapp.com>2014-02-01 11:49:04 +1100
commit2b754f49a57c4f625b73e703456bd5ff04496416 (patch)
treec8ce61f78835316de57e2439318a0f2679ab6d6a /Lib/concurrent
parentinspect: Add some comments in Parameter.__eq__ method (diff)
downloadcpython-2b754f49a57c4f625b73e703456bd5ff04496416.tar.gz
cpython-2b754f49a57c4f625b73e703456bd5ff04496416.tar.bz2
cpython-2b754f49a57c4f625b73e703456bd5ff04496416.zip
Issue #20319: concurrent.futures.wait() can block forever even if Futures have completed
Diffstat (limited to 'Lib/concurrent')
-rw-r--r--Lib/concurrent/futures/_base.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/concurrent/futures/_base.py b/Lib/concurrent/futures/_base.py
index c3b1f017e0e..acd05d0b2aa 100644
--- a/Lib/concurrent/futures/_base.py
+++ b/Lib/concurrent/futures/_base.py
@@ -225,7 +225,8 @@ def as_completed(fs, timeout=None):
finally:
for f in fs:
- f._waiters.remove(waiter)
+ with f._condition:
+ f._waiters.remove(waiter)
DoneAndNotDoneFutures = collections.namedtuple(
'DoneAndNotDoneFutures', 'done not_done')
@@ -272,7 +273,8 @@ def wait(fs, timeout=None, return_when=ALL_COMPLETED):
waiter.event.wait(timeout)
for f in fs:
- f._waiters.remove(waiter)
+ with f._condition:
+ f._waiters.remove(waiter)
done.update(waiter.finished_futures)
return DoneAndNotDoneFutures(done, set(fs) - done)