EsSyncPromise
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
EXAMPLE
| promise |
promise := EsPromise sync.
promise future then: [:v | self assert: [v = 42]].
promise complete: 42.
Class Methods
None
Instance Methods
complete:
Complete the future synchronously with the supplied value @aValue.
@see EsPromise>>complete: for more details
Arguments:
aValue - <Object>
Raises:
<EsAsyncStateError>
completeError:stackTrace:
Complete the future synchronously with the supplied error @anError
and @aStackTrace
@see EsPromise>>completeError: for more details
Arguments:
anError - <Object>
aStackTrace - <EsAsyncStackTrace>
Raises:
<EsAsyncStateError>
isCompleted
The future's #isComplete doesn't take into account pending completions.
Therefore #mayComplete is used.
@see EsPromise>>isCompleted for more details
Answers:
<Boolean>
Last modified date: 02/23/2021