Skip to main content

collect_any()

Wait on several tasks.

Usage

Source

collect_any(
    tasks,
    timeout=None,
)

Parameters

tasks: _Iterable[Task]

The Task handles to wait on.

timeout: float | None = None
Seconds to wait; None waits indefinitely.

Returns

(index, value) of the first task to finish, or the
TIMEOUT sentinel. A failure raises with an index attribute (0-based).

Raises

ConcurrentUseError
Another wait-half verb (a blocking collect, stop()) is in flight on this handle from a second thread: the waiting half is confined to one thread (the class docstring).