From 5680938a6c1fecfe9c665eaf9f3a8169777dbbb7 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 1 Aug 2023 12:34:13 -0400 Subject: [PATCH] fix: generalize type of `create_arg` --- src/pool.ml | 4 ++-- src/pool.mli | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pool.ml b/src/pool.ml index 2c74dfc5..55d78a10 100644 --- a/src/pool.ml +++ b/src/pool.ml @@ -160,12 +160,12 @@ let shutdown_ ~wait (self : state) : unit = if was_active then Array.iter Bb_queue.close self.qs; if wait then Array.iter Thread.join self.threads -type 'a create_args = +type ('a, 'b) create_args = ?on_init_thread:(dom_id:int -> t_id:int -> unit -> unit) -> ?on_exit_thread:(dom_id:int -> t_id:int -> unit -> unit) -> ?thread_wrappers:thread_loop_wrapper list -> ?on_exn:(exn -> Printexc.raw_backtrace -> unit) -> - ?around_task:(t -> 'a) * (t -> 'a -> unit) -> + ?around_task:(t -> 'b) * (t -> 'b -> unit) -> ?min:int -> ?per_domain:int -> 'a diff --git a/src/pool.mli b/src/pool.mli index f99b396c..11cac88b 100644 --- a/src/pool.mli +++ b/src/pool.mli @@ -28,18 +28,18 @@ val add_global_thread_loop_wrapper : thread_loop_wrapper -> unit thread, for all existing pools, and all new pools created with [create]. These wrappers accumulate: they all apply, but their order is not specified. *) -type 'a create_args = +type ('a, 'b) create_args = ?on_init_thread:(dom_id:int -> t_id:int -> unit -> unit) -> ?on_exit_thread:(dom_id:int -> t_id:int -> unit -> unit) -> ?thread_wrappers:thread_loop_wrapper list -> ?on_exn:(exn -> Printexc.raw_backtrace -> unit) -> - ?around_task:(t -> 'a) * (t -> 'a -> unit) -> + ?around_task:(t -> 'b) * (t -> 'b -> unit) -> ?min:int -> ?per_domain:int -> 'a (** Arguments used in {!create}. See {!create} for explanations. *) -val create : (unit -> t) create_args +val create : (unit -> t, _) create_args (** [create ()] makes a new thread pool. @param on_init_thread called at the beginning of each new thread in the pool. @@ -60,7 +60,7 @@ val create : (unit -> t) create_args the same thread after the task is over. (since 0.2) *) -val with_ : (unit -> (t -> 'a) -> 'a) create_args +val with_ : (unit -> (t -> 'a) -> 'a, _) create_args (** [with_ () f] calls [f pool], where [pool] is obtained via {!create}. When [f pool] returns or fails, [pool] is shutdown and its resources are released.