waitFor

Wait for the single Future to complete with timeout. If timeout is 0 or negative, block until the future completes.

@Coroutine
waitFor
(
Future
)
(
,
Future future
,
Duration timeout = Duration.zero
)
if (
is(Future : FutureHandle)
)

Parameters

eventLoop
Type: EventLoop

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

future
Type: Future

future to wait for.

timeout
Type: Duration

can be used to control the maximum time to wait before returning. If $(PARAM timeout) is 0 or negative, block until the future completes.

Return Value

Type: auto

result of the future. When a timeout occurs, it cancels the task and raises $(D_PSYMBOL TimeoutException). To avoid the task cancellation, wrap it in $(D_SYMBOL shield()).

Meta