MCPcopy Index your code
hub / github.com/python/cpython / _AsCompletedWaiter

Class _AsCompletedWaiter

Lib/concurrent/futures/_base.py:68–88  ·  view source on GitHub ↗

Used by as_completed().

Source from the content-addressed store, hash-verified

66 self.finished_futures.append(future)
67
68class _AsCompletedWaiter(_Waiter):
69 """Used by as_completed()."""
70
71 def __init__(self):
72 super(_AsCompletedWaiter, self).__init__()
73 self.lock = threading.Lock()
74
75 def add_result(self, future):
76 with self.lock:
77 super(_AsCompletedWaiter, self).add_result(future)
78 self.event.set()
79
80 def add_exception(self, future):
81 with self.lock:
82 super(_AsCompletedWaiter, self).add_exception(future)
83 self.event.set()
84
85 def add_cancelled(self, future):
86 with self.lock:
87 super(_AsCompletedWaiter, self).add_cancelled(future)
88 self.event.set()
89
90class _FirstCompletedWaiter(_Waiter):
91 """Used by wait(return_when=FIRST_COMPLETED)."""

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…