Promise α allows you to create a Task α whose value is provided later by calling resolve.
Typical usage is as follows:
let promise ← Promise.newcreates a promisepromise.result : Task αcan now be passed aroundpromise.result.getblocks until the promise is resolvedpromise.resolve aresolves the promisepromise.result.getnow returnsa
Every promise must eventually be resolved. Otherwise the memory used for the promise will be leaked, and any tasks depending on the promise's result will wait forever.
Equations
Instances For
Equations
- ⋯ = ⋯
@[extern lean_io_promise_new]
Creates a new Promise.
@[extern lean_io_promise_resolve]
Resolves a Promise.
Only the first call to this function has an effect.
@[extern lean_io_promise_result]
The result task of a Promise.
The task blocks until Promise.resolve is called.