await


Description:

[ CCode ( cname = "dex_await" ) ]
[ DestroysInstance ]
public bool await () throws Error

Suspends the current [class@Dex.

Fiber] and resumes when this has completed.

If this is completed when this function is called, the fiber will handle the result immediately.

This function may only be called within a `DexFiber`. To do otherwise will return false and throws set to dex_error_no_fiber.

It is an error to call this function in a way that would cause intermediate code to become invalid when resuming the stack. For example, if a foreach-style function taking a callback was to suspend from the callback, undefined behavior may occur such as thread-local-storage having changed.

Parameters:

this

a [class@Dex.Future]

Returns:

true if the future resolved, otherwise false and throws is set.