wait

Wait for the Future instances given by $(PARAM futures) to complete.

@Coroutine
wait
(
Future
)
(
,
Future[] futures
,
Duration timeout = Duration.zero
,
ReturnWhen returnWhen = ReturnWhen.ALL_COMPLETED
)
if (
is(Future : FutureHandle)
)

Parameters

eventLoop
Type: EventLoop

event loop, $(D_PSYMBOL getEventLoop) if not specified.

futures
Type: Future[]

futures to wait for.

timeout
Type: Duration

can be used to control the maximum number of seconds to wait before returning. If $(PARAM timeout) is 0 or negative there is no limit to the wait time.

returnWhen

indicates when this function should return. It must be one of the following constants: FIRST_COMPLETED The function will return when any future finishes or is cancelled. FIRST_EXCEPTION The function will return when any future finishes by raising an exception. If no future raises an exception then it is equivalent to ALL_COMPLETED. ALL_COMPLETED The function will return when all futures finish or are cancelled.

Return Value

Type: auto

a named 2-tuple of arrays. The first array, named $(D_PSYMBOL done), contains the futures that completed (finished or were cancelled) before the wait completed. The second array, named $(D_PSYMBOL notDone), contains uncompleted futures.

Meta