Retrieves the value of the promise, suspending the fiber running the action until the result is available.
Completes the promise with the specified result.
Completes the promise with the specified result. If the specified promise has already been completed, the method will produce false.
Kills the promise with the specified error, which will be propagated to all fibers waiting on the value of the promise.
Exits the promise with the specified exit, which will be propagated to all fibers waiting on the value of the promise.
Fails the promise with the specified error, which will be propagated to all fibers waiting on the value of the promise.
Halts the promise with the specified cause, which will be propagated to all fibers waiting on the value of the promise.
Completes the promise with interruption.
Completes the promise with interruption. This will interrupt all fibers waiting on the value of the promise.
Checks for completion of this Promise.
Checks for completion of this Promise. Produces true if this promise has already been completed with a value or an error and false otherwise.
Completes immediately this promise and returns optionally it's result.
Completes the promise with the specified value.
Alias for Promise.complete
Alias for Promise.complete
(Since version 1.0.0) use Promise.complete
A promise represents an asynchronous variable, of zio.IO type, that can be set exactly once, with the ability for an arbitrary number of fibers to suspend (by calling
await
) and automatically resume when the variable is set.Promises can be used for building primitive actions whose completions require the coordinated action of multiple fibers, and for building higher-level concurrent or asynchronous structures.