Module Async_kernel
Contains Async's core data structures, like Deferred
, Ivar
, and Clock
.
Async_kernel
is designed to depend only on Core_kernel
(as opposed to Core
), and so is more platform-independent.
module Async_kernel_config : sig ... end
Settings that globally affect the behavior of Async.
module Async_kernel_require_explicit_time_source = Async_kernel__.Require_explicit_time_source
module 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.
module Bvar : sig ... end
A
Bvar
is a synchronization point that allows one tobroadcast
a value to clientswait
ing on the broadcast. With aBvar
, one can efficiently notify multiple clients of edge-triggered conditions, repeating as each edge trigger occurs.
module Clock_ns : sig ... end
Provides a
Clock
withTime_ns
as the unit.
module Condition = Async_kernel__.Async_condition
module Deferred : sig ... end
A value that will become determined asynchronously.
module Execution_context : sig ... end
The context in which an Async job runs.
module Gc = Async_kernel__.Async_gc
module Invariant = Async_kernel__.Async_invariant
module Ivar : sig ... end
A write-once cell that can be empty or full (i.e., hold a single value).
module Lazy_deferred : sig ... end
A delayed computation that can produce a deferred.
module 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 theDeferred
monad and used with various containers in modulesDeferred.Array
,Deferred.List
,Deferred.Queue
, andDeferred.Sequence
. TheMonad_sequence.how
type specifies the parallelism of container iterators.
module Monitor : sig ... end
The part of the
Execution_context
that determines what to do when there is an unhandled exception.
module Mvar : sig ... end
An
Mvar
is a mutable location that is either empty or contains a value. One canput
orset
the value, and wait onvalue_available
for the location to be filled in either way.
module Pipe : sig ... end
A buffered FIFO communication channel.
module Priority : sig ... end
The priority of a job.
module Sequencer = Throttle.Sequencer
module Stream = Async_kernel__.Async_stream
module Synchronous_time_source : sig ... end
A synchronous version of
Async_kernel.Time_source
.advance_by_alarms
runs alarms immediately, rather than enqueueing Async jobs.
module Tail : sig ... end
A pointer to the end of an
Async_stream
that can be used to extend the stream.
module Throttle : sig ... end
A way to limit the number of concurrent computations.
module Time_source : sig ... end
Toplevel functions
The functions below are broadly useful when writing Async programs, and so are made available at the toplevel.
val after : Async_kernel__.Import.Time_ns.Span.t -> unit Async_kernel__.Clock_intf.Deferred.t
val at : Async_kernel__.Import.Time_ns.t -> unit Async_kernel__.Clock_intf.Deferred.t
val catch : ((unit -> unit) -> exn Monitor.Deferred.t) Monitor.with_optional_monitor_name
val choice : 'a Deferred.t -> ('a -> 'b) -> 'b Deferred.Choice.t
val choose : 'a Deferred.Choice.t list -> 'a Deferred.t
val don't_wait_for : unit Deferred.t -> unit
val every : ?start:unit Async_kernel__.Clock_intf.Deferred.t -> ?stop:unit Async_kernel__.Clock_intf.Deferred.t -> ?continue_on_error:bool -> Async_kernel__.Import.Time_ns.Span.t -> (unit -> unit) -> unit
val never : unit -> 'a Deferred.t
val schedule : ((unit -> unit) -> unit) Async_kernel__.Scheduler.with_options
val schedule' : ((unit -> 'a Async_kernel__.Scheduler.Deferred.t) -> 'a Async_kernel__.Scheduler.Deferred.t) Async_kernel__.Scheduler.with_options
val try_with : (?extract_exn:bool -> ?run:[ `Now | `Schedule ] -> ?rest:[ `Call of exn -> unit | `Log | `Raise ] -> (unit -> 'a Monitor.Deferred.t) -> ('a, exn) Core_kernel.Result.t Monitor.Deferred.t) Monitor.with_optional_monitor_name
val upon : 'a Deferred.t -> ('a -> unit) -> unit
val with_timeout : Async_kernel__.Import.Time_ns.Span.t -> 'a Async_kernel__.Clock_intf.Deferred.t -> [ `Result of 'a | `Timeout ] Async_kernel__.Clock_intf.Deferred.t
val within : ((unit -> unit) -> unit) Async_kernel__.Scheduler.with_options
val within' : ((unit -> 'a Async_kernel__.Scheduler.Deferred.t) -> 'a Async_kernel__.Scheduler.Deferred.t) Async_kernel__.Scheduler.with_options
Infix operators and Let_syntax
support
include Core_kernel.Monad.Infix with type 'a t := 'a Deferred.t
val (>>>) : 'a Async_kernel__Deferred.t -> ('a -> unit) -> unit
equivalent to
Deferred.upon
.
val (>>=?) : ('a, 'b) Deferred.Result.t -> ('a -> ('c, 'b) Deferred.Result.t) -> ('c, 'b) Deferred.Result.t
equivalent to
Deferred.Result.bind
.
val (>>|?) : ('a, 'b) Deferred.Result.t -> ('a -> 'c) -> ('c, 'b) Deferred.Result.t
equivalent to
Deferred.Result.map
.
include Deferred.Let_syntax
val return : 'a -> 'a Deferred.t
include Base__.Monad_intf.Infix with type 'a t := 'a Deferred.t
module Let_syntax = Deferred.Let_syntax.Let_syntax