waitFor

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

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

Parameters

eventLoop EventLoop

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

future Future

future to wait for.

timeout 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