Up

Module Scheduler = Async_kernel.Scheduler1

Signature

include module type of Async_kernel.Scheduler0 with type t := Async_kernel.Scheduler0.t
include Async_kernel.Types.Scheduler
type t = {
mutable check_access
: (unit -> unit) option ;
mutable job_pool
: Types.Job_pool.t ;
normal_priority_jobs
: Types.Job_queue.t ;
low_priority_jobs
: Types.Job_queue.t ;
mutable main_execution_context
: Types.Execution_context.t ;
mutable current_execution_context
: Types.Execution_context.t ;
mutable uncaught_exn
: (Core_kernel.Std.Exn.t * Core_kernel.Std.Sexp.t) option ;
mutable cycle_count
: int ;
mutable cycle_start
: Async_kernel.Import.Time_ns.t ;
mutable run_every_cycle_start
: (unit -> unit) list ;
mutable last_cycle_time
: Async_kernel.Import.Time_ns.Span.t ;
mutable last_cycle_num_jobs
: int ;
mutable time_source
: Core_kernel.Std.read_write Types.Time_source.t1 ;
external_jobs
: Types.External_job.t Core_kernel.Std.Thread_safe_queue.t ;
mutable thread_safe_external_job_hook
: unit -> unit ;
mutable job_queued_hook
: (Async_kernel.Priority.t -> unit) option ;
mutable event_added_hook
: (Async_kernel.Import.Time_ns.t -> unit) option ;
mutable yield_ivar
: unit Types.Ivar.t option ;
mutable check_invariants
: bool ;
mutable max_num_jobs_per_priority_per_cycle
: Async_kernel.Import.Max_num_jobs_per_priority_per_cycle.t ;
mutable record_backtraces
: bool ;
}
val set_execution_context : t -> Async_kernel.Types.Execution_context.t -> unit
val debug : bool
type t = Async_kernel.Scheduler0.t = {
mutable check_access
: (unit -> unit) option ;
mutable job_pool
: Async_kernel.Job_pool.t ;
normal_priority_jobs
: Async_kernel.Job_queue.t ;
low_priority_jobs
: Async_kernel.Job_queue.t ;
mutable main_execution_context
: Async_kernel.Execution_context.t ;
mutable current_execution_context
: Async_kernel.Execution_context.t ;
mutable uncaught_exn
: (Core_kernel.Std.Exn.t * Core_kernel.Std.Sexp.t) option ;
mutable cycle_count
: int ;
mutable cycle_start
: Async_kernel.Import.Time_ns.t ;
mutable run_every_cycle_start
: (unit -> unit) list ;
mutable last_cycle_time
: Async_kernel.Import.Time_ns.Span.t ;
mutable last_cycle_num_jobs
: int ;
mutable time_source
: Core_kernel.Std.read_write Time_source.T1.t ;
external_jobs
: Async_kernel.External_job.t Core_kernel.Std.Thread_safe_queue.t ;
mutable thread_safe_external_job_hook
: unit -> unit ;
mutable job_queued_hook
: (Async_kernel.Priority.t -> unit) option ;
mutable event_added_hook
: (Async_kernel.Import.Time_ns.t -> unit) option ;
mutable yield_ivar
: unit Async_kernel.Types.Ivar.t Core_kernel.Std.sexp_opaque option ;
mutable check_invariants
: bool ;
mutable max_num_jobs_per_priority_per_cycle
: Async_kernel.Import.Max_num_jobs_per_priority_per_cycle.t ;
mutable record_backtraces
: bool ;
}
val sexp_of_t : t -> Sexplib.Sexp.t
val record_backtraces : t -> bool
val set_record_backtraces : t -> bool -> unit
val max_num_jobs_per_priority_per_cycle : t -> Async_kernel.Import.Max_num_jobs_per_priority_per_cycle.t
val set_max_num_jobs_per_priority_per_cycle : t -> Async_kernel.Import.Max_num_jobs_per_priority_per_cycle.t -> unit
val check_invariants : t -> bool
val set_check_invariants : t -> bool -> unit
val set_yield_ivar : t -> unit Async_kernel.Types.Ivar.t Core_kernel.Std.sexp_opaque option -> unit
val event_added_hook : t -> (Async_kernel.Import.Time_ns.t -> unit) option
val set_event_added_hook : t -> (Async_kernel.Import.Time_ns.t -> unit) option -> unit
val job_queued_hook : t -> (Async_kernel.Priority.t -> unit) option
val set_job_queued_hook : t -> (Async_kernel.Priority.t -> unit) option -> unit
val thread_safe_external_job_hook : t -> unit -> unit
val set_thread_safe_external_job_hook : t -> (unit -> unit) -> unit
val set_time_source : t -> Core_kernel.Std.read_write Time_source.T1.t -> unit
val last_cycle_num_jobs : t -> int
val set_last_cycle_num_jobs : t -> int -> unit
val last_cycle_time : t -> Async_kernel.Import.Time_ns.Span.t
val set_last_cycle_time : t -> Async_kernel.Import.Time_ns.Span.t -> unit
val run_every_cycle_start : t -> (unit -> unit) list
val set_run_every_cycle_start : t -> (unit -> unit) list -> unit
val cycle_start : t -> Async_kernel.Import.Time_ns.t
val set_cycle_start : t -> Async_kernel.Import.Time_ns.t -> unit
val cycle_count : t -> int
val set_cycle_count : t -> int -> unit
val uncaught_exn : t -> (Core_kernel.Std.Exn.t * Core_kernel.Std.Sexp.t) option
val set_uncaught_exn : t -> (Core_kernel.Std.Exn.t * Core_kernel.Std.Sexp.t) option -> unit
val current_execution_context : t -> Async_kernel.Execution_context.t
val set_current_execution_context : t -> Async_kernel.Execution_context.t -> unit
val main_execution_context : t -> Async_kernel.Execution_context.t
val set_main_execution_context : t -> Async_kernel.Execution_context.t -> unit
val low_priority_jobs : t -> Async_kernel.Job_queue.t
val normal_priority_jobs : t -> Async_kernel.Job_queue.t
val job_pool : t -> Async_kernel.Job_pool.t
val set_job_pool : t -> Async_kernel.Job_pool.t -> unit
val check_access : t -> (unit -> unit) option
val set_check_access : t -> (unit -> unit) option -> unit
module Fields : sig .. end
val uncaught_exn_unwrapped : t -> (Core_kernel.Std.Exn.t * Core_kernel.Std.Sexp.t) option
val uncaught_exn : t -> Core_kernel.Std.Error.t option
val num_pending_jobs : t -> int
val num_jobs_run : t -> int
val invariant : t -> unit
val enqueue : t -> Async_kernel.Execution_context.t -> ('a -> unit) -> 'a -> unit
val enqueue_job : t -> (Async_kernel.Execution_context.t * (Obj.t -> unit) * Obj.t, [
| `S1 of Obj.t -> unit
| `S2 of Obj.t
]) Core_kernel.Std.Pool.Slots.t Core_kernel.Std.Pool.Pointer.t -> free_job:bool -> unit
val create : unit -> t
val is_dead : t -> bool
val set_check_access : t -> (unit -> unit) option -> unit
val t_ref : t Core_kernel.Std.ref
val check_access : t -> unit
val t : unit -> t
val current_execution_context : t -> Async_kernel.Execution_context.t
val with_execution_context : t -> Async_kernel.Types.Execution_context.t -> f:(unit -> 'a) -> 'a
val got_uncaught_exn : t -> Core_kernel.Std.Exn.t -> Core_kernel.Std.Sexp.t -> unit
val start_cycle : t -> max_num_jobs_per_priority:Async_kernel.Import.Max_num_jobs_per_priority_per_cycle.t -> unit

start_cycle t ~max_num_jobs_per_priority enables subsequent calls of run_jobs to run up to max_num_jobs_per_priority jobs of each priority level.

val run_jobs : t -> (unit, exn * string) Core_kernel.Std._result

run_jobs t removes jobs from t one at a time and runs them, stopping as soon as an unhandled exception is raised, or when no more jobs can be run at any priority, as per ~max_num_jobs_per_priority.

val stabilize : t -> (unit, exn) Core_kernel.Std._result