CompletableDeferred
A Deferred that can be completed via public functions complete or cancel.
Note that the complete function returns false
when this deferred value is already complete or completing, while cancel returns true
as long as the deferred is still cancelling and the corresponding exception is incorporated into the final completion exception.
An instance of completable deferred can be created by CompletableDeferred()
function in active state.
All functions on this interface are thread-safe and can be safely invoked from concurrent coroutines without external synchronization.
Functions
Completes this deferred value exceptionally with a given exception. The result is true
if this deferred was completed as a result of this invocation and false
otherwise (if it was already completed).
Completes this deferred value with the value or exception in the given result. Returns true
if this deferred was completed as a result of this invocation and false
otherwise (if it was already completed).