Type of fiber. A fiber represent a suspended computation. Note that using the same fiber twice will execute it twice, which is probably not what you want. To share the result of a fiber, use an Ivar.t.
Execute a list of fibers in sequence. We use the short name to conform with the Applicative interface.
val sequential_map : 'a list->f:('a->'bt)->'b listt
val sequential_iter : 'a list->f:('a->unit t)->unit t
Forking + joining
The following functions combine forking 2 or more fibers followed by joining the results. The execution of the various fibers might be interleaved, however once the combining fiber has terminated, it is guaranteed that there are no fibers lingering around.
val fork_and_join : (unit ->'at)->(unit ->'bt)->('a * 'b)t
Start two fibers and wait for their results.
val fork_and_join_unit : (unit ->unit t)->(unit ->'at)->'at
with_error_handler f ~on_error calls on_error for every exception raised during the execution of f. This include exceptions raised when calling f () or during the execution of fibers after f () has returned. Exceptions raised by on_error are passed on to the parent error handler.
It is guaranteed that after the fiber has returned a value, on_error will never be called.
run t ~iter runs a fiber until it terminates. iter is used to implement the scheduler, it should block waiting for an event and return an ivar to fill.