package picos_std
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=862d61383e2df93a876bedcffb1fd1ddc0f96c50b0e9c07943a2aee1f0e182be
sha512=87805379017ef4a7f2c11b954625a3757a0f1431bb9ba59132202de278b3e41adbe0cdc20e3ab23b7c9a8c5a15faeb7ec79348e7d80f2b14274b00df0893b8c0
doc/picos_std.structured/Picos_std_structured/Promise/index.html
Module Picos_std_structured.Promise
Source
A cancelable promise.
ℹ️ In addition to using a promise to concurrently compute and return a value, a cancelable promise can also represent a concurrent fiber that will continue until it is explicitly canceled.
Represents a promise to return value of type 'a
.
await promise
awaits until the promise has completed and either returns the value
that the evaluation of the promise returned, raises the exception that the evaluation of the promise raised, or raises the Terminate
exception in case the promise has been canceled.
completed promise
returns an event that can be committed to once the promise has completed.
is_running promise
determines whether the completion of the promise is still pending.
try_terminate promise
tries to terminate the promise by canceling it with the Terminate
exception and returns true
in case of success and false
in case the promise had already completed, i.e. either returned, raised, or canceled.
The optional callstack
argument specifies the number of callstack entries to capture with the Terminate
exception. The default is 0
.
terminate promise
is equivalent to try_terminate promise |> ignore
.