EsSyncPromise
Description
A way to produce EsFuture objects and synchronously complete them later with a value or error.
A synchronous promise is only intended for optimizing event propagation when one asynchronous event immediately triggers another. It should not be used unless the calls to #complete: and #completeError: are guaranteed to occur in places where it won't break <EsFuture> invariants.
This promise is intended to be instantiated by calling EsPromise sync.
Also see additional comments in EsPromise>>sync
Examples
| promise |
promise := EsPromise sync.
promise future then: [:v | self assert: [v = 42]].
promise complete: 42.
Class Methods
None
Instance Methods
<details> complete:
<pre><code> Complete the future synchronously with the supplied value @aValue.
@see EsPromise>>complete: for more details
Arguments:
aValue - <Object>
Raises:
<EsAsyncStateError>
</code></pre> </details>
<details> isCompleted
<pre><code> The future's #isComplete doesn't take into account pending completions. Therefore #mayComplete is used.
@see EsPromise>>isCompleted for more details
Answers:
<Boolean>
</code></pre> </details>
Last modified date: 04/21/2022