module ScheduledThreadPoolExecutor: sig .. end
Thread pools for scheduled futures.
type t
The type of thread pools to be used for scheduled futures.
val make : int32 -> RejectedExecutionHandler.t -> t
make cps reh
returns a new thread pool with:
cps
as its core pool size (number of threads kept in the pool,
even if idle);
reh
policy for blocked computations.
Raises
Invalid_argument
if
cps
is negative.
val await_termination : t -> int64 -> TimeUnit.t -> bool
val get_active_count : t -> int32
val get_completed_task_count : t -> int64
val get_continue_existing_periodic_tasks_after_shutdown_policy : t -> bool
Tests whether periodic tasks should continue execution after
shutdown.
val get_core_pool_size : t -> int32
val get_execute_existing_delayed_tasks_after_shutdown_policy : t -> bool
Tests whether delayed tasks should continue execution after
shutdown.
val get_largest_pool_size : t -> int32
val get_maximum_pool_size : t -> int32
val get_pool_size : t -> int32
val get_remove_on_cancel_policy : t -> bool
Tests whether tasks should be removed when cancelled.
val get_task_count : t -> int64
val invoke_all : t -> (unit -> 'a) list -> 'a Future.t list
val invoke_any : t -> (unit -> 'a) list -> 'a
val invoke_any_time : t ->
(unit -> 'a) list -> int64 -> TimeUnit.t -> 'a
val is_shutdown : t -> bool
val is_terminated : t -> bool
val is_terminating : t -> bool
val schedule : t ->
('a -> 'b) -> 'a -> int64 -> TimeUnit.t -> 'b ScheduledFuture.t
schedule p f x t u
is similar to submit p f x
, except that the
evaluation of f x
with start after t
(time value whose unit is
u
).
Raises Failure
if pool limits are reached.
val schedule_at_fixed_rate : t ->
('a -> unit) -> 'a -> int64 -> int64 -> TimeUnit.t -> unit ScheduledFuture.t
schedule_at_fixed_rate p f x t d u
is similar to schedule p f x t u
,
except that f x
will be re-evaluated at t + d
, t + 2 * d
, etc.
Raises Failure
if pool limits are reached.
Raises Invalid_argument
if d
is negative.
val schedule_with_fixed_delay : t ->
('a -> unit) -> 'a -> int64 -> int64 -> TimeUnit.t -> unit ScheduledFuture.t
schedule_with_fixed_delay p f x t d u
is similar to schedule p f x t u
,
except that f x
will be repeatedly re-evaluated, respecting a delay
of d
between the end of one execution and the beginning of the next
one.
Raises Failure
if pool limits are reached.
Raises Invalid_argument
if d
is negative.
val set_continue_existing_periodic_tasks_after_shutdown_policy : t -> bool -> unit
Changes whether periodic tasks should continue execution after
shutdown.
val set_core_pool_size : t -> int32 -> unit
val set_execute_existing_delayed_tasks_after_shutdown_policy : t -> bool -> unit
changes whether delayed tasks should continue execution after
shutdown.
val set_keep_alive_time : t -> int64 -> TimeUnit.t -> unit
val set_maximum_pool_size : t -> int32 -> unit
val set_remove_on_cancel_policy : t -> bool -> unit
Changes whether tasks should be removed when cancelled.
val submit : t -> ('a -> 'b) -> 'a -> 'b Future.t