package miou

  1. Overview
  2. Docs
Composable concurrency primitives for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

miou-0.5.1.tbz
sha256=129339f4a60fc9579ee118d693056caf00be3b68c7a52ea974b91b1f25e4dd63
sha512=5603847cce524c04e9a5dca268fc1050fbf2e4019b0e7fa24ee3d4941c4dce38e17f49b39c7f812634d1ab9b4d0cb02c5103c8c0c644c174df48074763801ffd

doc/miou.sync/Miou_sync/Computation/index.html

Module Miou_sync.ComputationSource

Sourcetype 'a state =
  1. | Cancelled of exn * Printexc.raw_backtrace
  2. | Returned of 'a
  3. | Continue of {
    1. balance : int;
    2. triggers : Trigger.t list;
    }
Sourcetype !'a t = private 'a state Atomic.t
Sourceval create : unit -> 'a t

create () creates a new computation in the running state.

Sourceval try_return : 'a t -> 'a -> bool

try_return c value attempts to complete the computation with the specified value and returns true on success. Otherwise returns false, which means that the computation had already been completed before.

Sourceval try_capture : 'a t -> ('b -> 'a) -> 'b -> bool

try_capture c fn x calls fn x and tries to complete the computation with the value returned or the exception raised by the call and returns true on success. Otherwise returns false, which means that the computation had already been completed before.

Sourceval try_cancel : 'a t -> (exn * Printexc.raw_backtrace) -> bool

try_cancel c (exn, bt) attempts to mark the computation c as cancelled with the specified exception and backtrace and returns true on success. Otherwise returns false, which means that the computation had already been completed before.

Sourceval is_running : 'a t -> bool

is_running c determines whether the computation c is in the running state meaning that it has not yet been completed.

Sourceval cancelled : 'a t -> (exn * Printexc.raw_backtrace) option

cancelled c returns the exception that the computation has been cancelled with or returns None in case the computation has not been cancelled.

Sourceval raise_if_errored : 'a t -> unit

raise_if_errored raises the exception the computation was cancelled with if it was errored.

Sourceval peek : 'a t -> ('a, exn * Printexc.raw_backtrace) result option

peek c returns the result of the computation c or None in case the computation has not completed.

Sourceval try_attach : 'a t -> Trigger.t -> bool

try_attach c trigger tries to attach the trigger to be signaled on completion of the computation and returns true on success. Otherwise, it returns false, which means that the computation has already been completed or the trigger has already been signaled.

Sourceval detach : 'a t -> Trigger.t -> unit

detach c trigger signals the trigger and detaches it from the computation c.

Sourceval clean : 'a t -> unit
Sourceval await : 'a t -> ('a, exn * Printexc.raw_backtrace) result

await c waits for the computation to complete and either returns the value of the completed computation or the exception the computation was cancelled with.

Sourceval await_exn : 'a t -> 'a
Sourceval canceller : from:'a t -> into:'b t -> Trigger.t