summaryrefslogtreecommitdiffstats
path: root/Lib/concurrent/futures/_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/concurrent/futures/_base.py')
-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 c3b1f01..acd05d0 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)