-
Effekt Library
- io/promise
- State
- Pending
- Resolved
- Promise
- promise
- make
- promise
- await
- resolve
- io/promise Jump to source: libraries/common/io/promise.effekt
- State
[T] - Pending
(signals: List[Signal[T, Unit]]) - Resolved
(value: T) - Promise
[T] - promise
- make
[T]: Promise[T] / {} - promise
[T] (task: => T at {io,async,global}): Promise[T] / {} - await
[T] (promise: Promise[T]): T / {} - resolve
[T] (promise: Promise[T], value: T): Unit / {}
Example usage: examples/stdlib/io/promise
Creates a pending promise that must be resolved exactly once and can be awaited multiple times.
Spawns a task and immediately returns a promise that upon completion of the task will resolve to its result.
Awaits and blocks until the given promise is resolved.
Resolves the given promise, unblocking all awaiting tasks.