Module Async.Call

Existential Fun.Async.t.

Call identifiers

type id = int

The type for call identifiers.

val none_id : id

none_id is id none.

val pp_id : Stdlib.Format.formatter -> id -> unit

pp_id formats call ids.

Calls

type 'a async_fun := 'a Async.t
type t

The type for existential Affect.Fun.Async.t values.

val current : unit -> t

current () is the call handle of the caller.

val none : t

none is a call handle for when there is none. For example it is the parent of the root asynchronous call.

Properties

val id : t -> id

id call is a unique identifier for the call. It matches the value Type.Id.uid of the Affect.Fun.Async.id of the asynchronous function call.

val parent : t -> t

parent c is the parent of c that is the function that called it. If c is the root asynchronous function this is none.

val schedule : t -> Schedule.t

schedule c is the schedule of c specified at Fun.Async.call time.

val priority : t -> Schedule.priority

priority c is the current priority of c.

Cancellation

val cancel : t -> unit

cancel c is Affect.Fun.Async.cancel on the call.

val is_cancelled : t -> bool

is_cancelled c Affect.Fun.Async.is_cancelled on the call.

val wait_cancelled : t -> 'tag -> 'tag Action.Private.Action.t

wait_cancelled c tag is Affect.Fun.Async.wait_cancelled on the call.

Predicates and comparisons

val is_none : t -> bool

is_none c is true if and only if c is none.

val is_only_main : t -> bool

is_only_main c is true if and only if c is only scheduled on the main domain of the scheduler.

val has_returned : t -> bool

has_returned c is Affect.Fun.Async.has_returned on the call.

val equal : t -> t -> bool

equal c0 c1 is true if and only if c0 and c1 identify as the same call.

val compare : t -> t -> int

compare is a total order on calls compatible with equal.

Converting

val of_async_fun : 'a async_fun -> t

of_async_fun f is f as a call.

val to_async_fun : 'a Stdlib.Type.Id.t -> t -> 'a async_fun option

to_async_fun tid c is Some f with f the asynchronous function of c if and only if tid is the Fun.Async.id of f.

Formatting

val pp : Stdlib.Format.formatter -> t -> unit

pp formats calls like Fun.Async.pp.