MCPcopy Index your code
hub / github.com/RustPython/RustPython / _yield_finished_futures

Function _yield_finished_futures

Lib/concurrent/futures/_base.py:177–196  ·  view source on GitHub ↗

Iterate on the list *fs*, yielding finished futures one by one in reverse order. Before yielding a future, *waiter* is removed from its waiters and the future is removed from each set in the collection of sets *ref_collect*. The aim of this function is to avoid keeping stal

(fs, waiter, ref_collect)

Source from the content-addressed store, hash-verified

175
176
177def _yield_finished_futures(fs, waiter, ref_collect):
178 """
179 Iterate on the list *fs*, yielding finished futures one by one in
180 reverse order.
181 Before yielding a future, *waiter* is removed from its waiters
182 and the future is removed from each set in the collection of sets
183 *ref_collect*.
184
185 The aim of this function is to avoid keeping stale references after
186 the future is yielded and before the iterator resumes.
187 """
188 while fs:
189 f = fs[-1]
190 for futures_set in ref_collect:
191 futures_set.remove(f)
192 with f._condition:
193 f._waiters.remove(waiter)
194 del f
195 # Careful not to keep a reference to the popped value
196 yield fs.pop()
197
198
199def as_completed(fs, timeout=None):

Callers 1

as_completedFunction · 0.85

Calls 2

removeMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected