Function waitFor

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

Prototype

auto waitFor(Future)(
  EventLoop eventLoop,
  Future future,
  Duration timeout = Duration.zero
)
if (is(Future : FutureHandle));

Parameters

NameDescription
eventLoop event loop, getEventLoop if not specified.
future future to wait for.
timeout can be used to control the maximum time to wait before returning. If timeout is 0 or negative, block until the future completes.

Returns

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

Authors

Dragos Carp

Copyright

© 2015-2016 Dragos Carp

License

Boost Software License - Version 1.0