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

Function _create_and_install_waiters

Lib/concurrent/futures/_base.py:149–168  ·  view source on GitHub ↗
(fs, return_when)

Source from the content-addressed store, hash-verified

147 future._condition.release()
148
149def _create_and_install_waiters(fs, return_when):
150 if return_when == _AS_COMPLETED:
151 waiter = _AsCompletedWaiter()
152 elif return_when == FIRST_COMPLETED:
153 waiter = _FirstCompletedWaiter()
154 else:
155 pending_count = sum(
156 f._state not in [CANCELLED_AND_NOTIFIED, FINISHED] for f in fs)
157
158 if return_when == FIRST_EXCEPTION:
159 waiter = _AllCompletedWaiter(pending_count, stop_on_exception=True)
160 elif return_when == ALL_COMPLETED:
161 waiter = _AllCompletedWaiter(pending_count, stop_on_exception=False)
162 else:
163 raise ValueError("Invalid return condition: %r" % return_when)
164
165 for f in fs:
166 f._waiters.append(waiter)
167
168 return waiter
169
170
171def _yield_finished_futures(fs, waiter, ref_collect):

Callers 2

as_completedFunction · 0.85
waitFunction · 0.85

Calls 4

_AsCompletedWaiterClass · 0.85
_AllCompletedWaiterClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…