package async_kernel
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=30753e014bb0b127ee59f10b1073b8ae476468fb2f07dc8c99dbe2ef312fc696
doc/async_kernel/Async_kernel/index.html
Module Async_kernel
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.
module Async_kernel_config = Async_kernel_configmodule Async_kernel_require_explicit_time_source : sig ... endDeprecates functions that use wall-clock time, so that code must be explicit about what time source is used.
module Async_kernel_scheduler : sig ... endThe 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 ... endA 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.
module Clock_ns : sig ... endProvides a Clock with Time_ns as the unit.
module Condition : sig ... endAsync's implementation of the standard notion of a "condition" variable.
module Deferred : sig ... endA value that will become determined asynchronously.
module Execution_context : sig ... endThe context in which an Async job runs.
module Gc : sig ... endAsync's analog of Core.Gc.
module Invariant : sig ... endmodule Ivar : sig ... endA write-once cell that can be empty or full (i.e., hold a single value).
module Lazy_deferred : sig ... endA delayed computation that can produce a deferred.
module Monad_sequence : sig ... endMonad_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.
module Monitor : sig ... endThe part of the Execution_context that determines what to do when there is an unhandled exception.
module Mvar : sig ... endAn 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.
module Pipe : sig ... endA buffered FIFO communication channel.
module Priority : sig ... endA 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.
module Sequencer = Throttle.Sequencermodule Stream : sig ... endAn immutable sequence of values, with a possibly incomplete tail that may be extended asynchronously.
module Synchronous_time_source : sig ... endA synchronous version of Async_kernel.Time_source. advance_by_alarms runs alarms immediately, rather than enqueueing Async jobs.
module Tail : sig ... endA pointer to the end of an Async_stream that can be used to extend the stream.
module Throttle : sig ... endA way to limit the number of concurrent computations.
module Time_source : sig ... endToplevel functions
The functions below are broadly useful when writing Async programs, and so are made available at the toplevel.
val after : Core.Core_private.Time_ns_alternate_sexp.Span.t -> unit Deferred.tval at : Core.Time_ns.t -> unit Deferred.tval catch :
((unit -> unit) -> exn Deferred.t) Monitor.with_optional_monitor_nameval choice : 'a Deferred.t -> ('a -> 'b) -> 'b Deferred.Choice.tval choose : 'a Deferred.Choice.t list -> 'a Deferred.tval don't_wait_for : unit Deferred.t -> unitval every :
?start:unit Deferred.t ->
?stop:unit Deferred.t ->
?continue_on_error:bool ->
Core.Core_private.Time_ns_alternate_sexp.Span.t ->
(unit -> unit) ->
unitval never : unit -> 'a Deferred.tval schedule :
?monitor:Monitor.t ->
?priority:Priority.t ->
(unit -> unit) ->
unitval schedule' :
?monitor:Monitor.t ->
?priority:Priority.t ->
(unit -> 'a Deferred.t) ->
'a Deferred.tval 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_nameval upon : 'a Deferred.t -> ('a -> unit) -> unitval with_timeout :
Core.Core_private.Time_ns_alternate_sexp.Span.t ->
'a Deferred.t ->
'a Clock_ns.Or_timeout.t Deferred.tval within :
?monitor:Monitor.t ->
?priority:Priority.t ->
(unit -> unit) ->
unitval within' :
?monitor:Monitor.t ->
?priority:Priority.t ->
(unit -> 'a Deferred.t) ->
'a Deferred.tInfix operators and Let_syntax support
include Core.Monad.Infix with type 'a t := 'a Deferred.t
val (>>>) : 'a Deferred.t -> ('a -> unit) -> unitequivalent to Deferred.upon.
val (>>=?) :
('a, 'b) Deferred.Result.t ->
('a -> ('c, 'b) Deferred.Result.t) ->
('c, 'b) Deferred.Result.tequivalent to Deferred.Result.bind.
val (>>|?) :
('a, 'b) Deferred.Result.t ->
('a -> 'c) ->
('c, 'b) Deferred.Result.tequivalent to Deferred.Result.map.
include module type of struct include Deferred.Let_syntax end
val return : 'a -> 'a Deferred.tval (>>=) : 'a Deferred.t -> ('a -> 'b Deferred.t) -> 'b Deferred.tval (>>|) : 'a Deferred.t -> ('a -> 'b) -> 'b Deferred.tmodule Let_syntax = Deferred.Let_syntax.Let_syntax