Function wait

Wait for the Future instances given by futures to complete.

Prototype

auto wait(Future)(
  EventLoop eventLoop,
  Future[] futures,
  Duration timeout = Duration.zero,
  ReturnWhen returnWhen = ReturnWhen.ALL_COMPLETED
)
if (is(Future : FutureHandle));

Parameters

NameDescription
eventLoop event loop, getEventLoop if not specified.
futures futures to wait for.
timeout can be used to control the maximum number of seconds to wait before returning. If 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.

Returns

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

Authors

Dragos Carp

Copyright

© 2015-2016 Dragos Carp

License

Boost Software License - Version 1.0