module Jobs: sig
.. end
A Jobs.t
has a queue of jobs at each priority level.
module Priority: sig
.. end
A Jobs.t
has a queue of jobs at each priority level.
type 'job
t
val invariant : 'a t -> unit
val create : dummy:'a -> 'a t
val length : 'a t -> int
length t
returns the number of waiting jobs
val is_empty : 'a t -> bool
is_empty t
returns true if there are no waiting jobs.
val add : 'job t -> Priority.t -> 'job -> unit
val clear : 'a t -> unit
clear t
removes all jobs from t
.
val start_cycle : 'a t -> max_num_jobs_per_priority:int -> unit
start_cycle t ~max_num_jobs_per_priority
enables subsequent calls of run_all
to
run up to max_num_jobs_per_priority
jobs of each priority level.
val force_current_cycle_to_end : 'a t -> unit
force_current_cycle_to_end
sets the number of normal jobs allowed to run in this
cycle to zero. Thus, after the currently running job completes, the scheduler will
switch to low priority jobs and then end the current cycle.
val run_all : 'job t -> ('job -> unit) -> (unit, exn) Core.Std.Result.t
run_all t f
removes jobs from t
one at a time and applies f
to 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 sexp_of_t : ('job -> Sexplib.Sexp.t) -> 'job t -> Sexplib.Sexp.t
length t
returns the number of waiting jobs
is_empty t
returns true if there are no waiting jobs.
clear t
removes all jobs from t
.
start_cycle t ~max_num_jobs_per_priority
enables subsequent calls of run_all
to
run up to max_num_jobs_per_priority
jobs of each priority level.
force_current_cycle_to_end
sets the number of normal jobs allowed to run in this
cycle to zero. Thus, after the currently running job completes, the scheduler will
switch to low priority jobs and then end the current cycle.
run_all t f
removes jobs from t
one at a time and applies f
to 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
.