package containers
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=03b80e963186e91ddac62ef645bf7fb2
sha512=c8f434808be540c16926bf03d89f394d33fc2d092f963a7b6d412481229e0a96290f1ad7c7d522415115d35426b7aa0b3fda4b991ddc321dad279d402c9a0c0b
doc/containers.thread/CCPool/Make/Fut/index.html
Module Make.Fut
Source
Futures
The futures are registration points for callbacks, storing a state
, that are executed in the pool using run
.
A future value of type 'a
Constructors
Create a future, representing a value that will be computed by the function. If the function raises, the future will fail.
Basics
Blocking get: wait for the future to be evaluated, and get the value, or the exception that failed the future is returned. Raise e if the future failed with e.
Combinators
Attach a handler to be called upon success. The handler should not call functions on the future. Might be evaluated now if the future is already done.
Attach a handler to be called upon failure. The handler should not call any function on the future. Might be evaluated now if the future is already done.
Attach a handler to be called when the future is evaluated. The handler should not call functions on the future. Might be evaluated now if the future is already done.
Wait for the first future to succeed, then launch the second.
Future that waits for all previous futures to terminate. If any future in the array fails, sequence_a l
fails too.
map_a f a
maps f
on every element of a
, and will return the array of every result if all calls succeed, or an error otherwise.
Future that waits for all previous futures to terminate. If any future in the list fails, sequence_l l
fails too.
map_l f l
maps f
on every element of l
, and will return the list of every result if all calls succeed, or an error otherwise.
Choose among those futures (the first to terminate). Behaves like the first future that terminates, by failing if the future fails.
Choose among those futures (the first to terminate). Behaves like the first future that terminates, by failing if the future fails.
Map the value inside the future, to be computed in a separated job.
Cartesian product of the content of these futures.
app_async f x
applies the result of f
to the result of x
, in a separated job scheduled in the pool.
Future that returns with success in the given amount of seconds. Blocks the thread! If you need to wait on many events, consider using CCTimer
.