package async_kernel

  1. Overview
  2. Docs
Monadic concurrency library

Install

Dune Dependency

Authors

Maintainers

Sources

async_kernel-v0.15.0.tar.gz
sha256=30753e014bb0b127ee59f10b1073b8ae476468fb2f07dc8c99dbe2ef312fc696

doc/async_kernel/Async_kernel/index.html

Module Async_kernelSource

Contains Async's core data structures, like Deferred, Ivar, and Clock.

Async_kernel is designed to depend only on Core and so is more platform-independent.

Sourcemodule Async_kernel_config = Async_kernel_config

Deprecates functions that use wall-clock time, so that code must be explicit about what time source is used.

Sourcemodule Async_kernel_scheduler : sig ... end

The Async scheduler is responsible for running Async jobs. It maintains the queue of jobs that need to run. A "cycle" consists of running some (possibly all) jobs in the queue, along with some other bookkeeping, like advancing Async's clock to the current time.

Sourcemodule Bvar : sig ... end

A Bvar is a synchronization point that allows one to broadcast a value to clients waiting on the broadcast. With a Bvar, one can efficiently notify multiple clients of edge-triggered conditions, repeating as each edge trigger occurs.

Sourcemodule Clock_ns : sig ... end

Provides a Clock with Time_ns as the unit.

Sourcemodule Condition : sig ... end

Async's implementation of the standard notion of a "condition" variable.

Sourcemodule Deferred : sig ... end

A value that will become determined asynchronously.

Sourcemodule Execution_context : sig ... end

The context in which an Async job runs.

Sourcemodule Gc : sig ... end

Async's analog of Core.Gc.

Sourcemodule Invariant : sig ... end
Sourcemodule Ivar : sig ... end

A write-once cell that can be empty or full (i.e., hold a single value).

Sourcemodule Lazy_deferred : sig ... end

A delayed computation that can produce a deferred.

Sourcemodule Monad_sequence : sig ... end

Monad_sequence.S is a generic interface specifying functions that deal with a container and a monad. It is specialized to the Deferred monad and used with various containers in modules Deferred.Array, Deferred.List, Deferred.Queue, and Deferred.Sequence. The Monad_sequence.how type specifies the parallelism of container iterators.

Sourcemodule Monitor : sig ... end

The part of the Execution_context that determines what to do when there is an unhandled exception.

Sourcemodule Mvar : sig ... end

An Mvar is a mutable location that is either empty or contains a value. One can put or set the value, and wait on value_available for the location to be filled in either way.

Sourcemodule Pipe : sig ... end

A buffered FIFO communication channel.

Sourcemodule Priority : sig ... end

A job's priority determines when in an async cycle the job is run. A "cycle" runs a bounded number of Normal priority jobs followed by a bounded number of Low priority jobs. The bound is Async_kernel_config.max_num_jobs_per_priority_per_cycle.

Sourcemodule Sequencer = Throttle.Sequencer
Sourcemodule Stream : sig ... end

An immutable sequence of values, with a possibly incomplete tail that may be extended asynchronously.

Sourcemodule Synchronous_time_source : sig ... end

A synchronous version of Async_kernel.Time_source. advance_by_alarms runs alarms immediately, rather than enqueueing Async jobs.

Sourcemodule Tail : sig ... end

A pointer to the end of an Async_stream that can be used to extend the stream.

Sourcemodule Throttle : sig ... end

A way to limit the number of concurrent computations.

Sourcemodule Time_source : sig ... end

Toplevel functions

The functions below are broadly useful when writing Async programs, and so are made available at the toplevel.

Sourceval catch : ((unit -> unit) -> exn Deferred.t) Monitor.with_optional_monitor_name
Sourceval choice : 'a Deferred.t -> ('a -> 'b) -> 'b Deferred.Choice.t
Sourceval choose : 'a Deferred.Choice.t list -> 'a Deferred.t
Sourceval don't_wait_for : unit Deferred.t -> unit
Sourceval every : ?start:unit Deferred.t -> ?stop:unit Deferred.t -> ?continue_on_error:bool -> Core.Core_private.Time_ns_alternate_sexp.Span.t -> (unit -> unit) -> unit
Sourceval never : unit -> 'a Deferred.t
Sourceval schedule : ?monitor:Monitor.t -> ?priority:Priority.t -> (unit -> unit) -> unit
Sourceval schedule' : ?monitor:Monitor.t -> ?priority:Priority.t -> (unit -> 'a Deferred.t) -> 'a Deferred.t
Sourceval try_with : (?extract_exn:bool -> ?run:[ `Now | `Schedule ] -> ?rest:[ `Call of exn -> unit | `Log | `Raise ] -> (unit -> 'a Deferred.t) -> ('a, exn) Core.Result.t Deferred.t) Monitor.with_optional_monitor_name
Sourceval upon : 'a Deferred.t -> ('a -> unit) -> unit
Sourceval within : ?monitor:Monitor.t -> ?priority:Priority.t -> (unit -> unit) -> unit
Sourceval within' : ?monitor:Monitor.t -> ?priority:Priority.t -> (unit -> 'a Deferred.t) -> 'a Deferred.t

Infix operators and Let_syntax support

include Core.Monad.Infix with type 'a t := 'a Deferred.t
Sourceval (>>>) : 'a Deferred.t -> ('a -> unit) -> unit

equivalent to Deferred.upon.

Sourceval (>>=?) : ('a, 'b) Deferred.Result.t -> ('a -> ('c, 'b) Deferred.Result.t) -> ('c, 'b) Deferred.Result.t

equivalent to Deferred.Result.bind.

Sourceval (>>|?) : ('a, 'b) Deferred.Result.t -> ('a -> 'c) -> ('c, 'b) Deferred.Result.t

equivalent to Deferred.Result.map.

include module type of struct include Deferred.Let_syntax end
Sourceval return : 'a -> 'a Deferred.t
val (>>=) : 'a Deferred.t -> ('a -> 'b Deferred.t) -> 'b Deferred.t
val (>>|) : 'a Deferred.t -> ('a -> 'b) -> 'b Deferred.t
OCaml

Innovation. Community. Security.