Up

Module Scheduler = Scheduler1

Signature

include module type of Scheduler0 with type t := Scheduler0.t
include 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
: Import.Time_ns.t ;
mutable run_every_cycle_start
: (unit -> unit) list ;
mutable last_cycle_time
: 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
: (Priority.t -> unit) option ;
mutable event_added_hook
: (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
: Import.Max_num_jobs_per_priority_per_cycle.t ;
mutable record_backtraces
: bool ;
}
val set_execution_context : t -> Types.Execution_context.t -> unit
val debug : bool
type t = Scheduler0.t = {
mutable check_access
: (unit -> unit) option ;
mutable job_pool
: Job_pool.t ;
normal_priority_jobs
: Job_queue.t ;
low_priority_jobs
: Job_queue.t ;
mutable main_execution_context
: Execution_context.t ;
mutable current_execution_context
: Execution_context.t ;
mutable uncaught_exn
: (Core_kernel.Std.Exn.t * Core_kernel.Std.Sexp.t) option ;
mutable cycle_count
: int ;
mutable cycle_start
: Import.Time_ns.t ;
mutable run_every_cycle_start
: (unit -> unit) list ;
mutable last_cycle_time
: 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
: External_job.t Core_kernel.Std.Thread_safe_queue.t ;
mutable thread_safe_external_job_hook
: unit -> unit ;
mutable job_queued_hook
: (Priority.t -> unit) option ;
mutable event_added_hook
: (Import.Time_ns.t -> unit) option ;
mutable yield_ivar
: unit Types.Ivar.t Core_kernel.Std.sexp_opaque option ;
mutable check_invariants
: bool ;
mutable max_num_jobs_per_priority_per_cycle
: 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 -> Import.Max_num_jobs_per_priority_per_cycle.t
val set_max_num_jobs_per_priority_per_cycle : t -> Import.Max_num_jobs_per_priority_per_cycle.t -> unit
val check_invariants : t -> bool
val set_check_invariants : t -> bool -> unit
val yield_ivar : t -> unit Types.Ivar.t Core_kernel.Std.sexp_opaque option
val set_yield_ivar : t -> unit Types.Ivar.t Core_kernel.Std.sexp_opaque option -> unit
val event_added_hook : t -> (Import.Time_ns.t -> unit) option
val set_event_added_hook : t -> (Import.Time_ns.t -> unit) option -> unit
val job_queued_hook : t -> (Priority.t -> unit) option
val set_job_queued_hook : t -> (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 -> Import.Time_ns.Span.t
val set_last_cycle_time : t -> 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 -> Import.Time_ns.t
val set_cycle_start : t -> 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 -> Execution_context.t
val set_current_execution_context : t -> Execution_context.t -> unit
val main_execution_context : t -> Execution_context.t
val set_main_execution_context : t -> Execution_context.t -> unit
val low_priority_jobs : t -> Job_queue.t
val normal_priority_jobs : t -> Job_queue.t
val job_pool : t -> Job_pool.t
val set_job_pool : t -> 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 -> Execution_context.t -> ('a -> unit) -> 'a -> unit
val enqueue_job : t -> (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 -> Execution_context.t
val with_execution_context : t -> Types.Execution_context.t -> f:(unit -> 'a) -> 'a
val create_job : t -> Execution_context.t -> ('a -> unit) -> 'a -> (Execution_context.t, Obj.t -> unit, Obj.t) Core_kernel.Std.Pool.Slots.t3 Core_kernel.Std.Pool.Pointer.t
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: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