Method await()


Method await

mixed await(Concurrent.Future future)

Description

Stop execution of the current restartable function for now. Resume when the future completes.

Returns

Evaluates to the result of the future if it succeeds.

Throws

Throws an error if the future failed.

Calling this special form is similar to the expression:

(future->on_await(continue::this_function), yield())
Note

Use of this from a non-restartable functions causes a compilation warning and falls back to calling future->get(). This will thus then perform a wait blocking the current thread.

Note

No checks that the future has actually completed are performed. It is assumed that nothing else will call the restartable function during the wait.

See also

Concurrent.Future()->get(), yield(), continue::this_function, Restartable functions