module Throttle: Throttle
type
t
include Invariant.S
val create : continue_on_error:bool -> max_concurrent_jobs:int -> t
create ~continue_on_error ~max_concurrent_jobs
returns a throttle that will runs up
to max_concurrent_jobs
concurrently.
If some job raises an exception, then the throttle will stop, unless
continue_on_error
is true.
type'a
outcome =[ `Aborted | `Ok of 'a | `Raised of exn ]
module Job:sig
..end
val enqueue_job : t -> 'a Job.t -> unit
val enqueue' : t -> (unit -> 'a Deferred.t) -> 'a outcome Deferred.t
enqueue t ~monitor job
schedules job
to be run as soon as possible. Jobs are
guaranteed to be started in the order they are enqueue
d.
enqueue
raises an exception if the throttle is dead.
val enqueue : t -> (unit -> 'a Deferred.t) -> 'a Deferred.t
val prior_jobs_done : t -> unit Deferred.t
prior_jobs_done t
becomes determined when all of the jobs that were previously
enqueued in t
have completed.val num_jobs_waiting_to_start : t -> int
module Sequencer:sig
..end
val sexp_of_t : t -> Sexplib.Sexp.t