add Pool.size

This commit is contained in:
Simon Cruanes 2023-06-02 12:05:39 -04:00
parent 1f31f26edf
commit 6ffbd15a34
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
3 changed files with 5 additions and 1 deletions

View file

@ -11,8 +11,8 @@ depends: [
"ocaml" {>= "4.08"} "ocaml" {>= "4.08"}
"dune" {>= "3.0"} "dune" {>= "3.0"}
"either" "either"
"mdx" {>= "1.9.0" & with-test}
"odoc" {with-doc} "odoc" {with-doc}
"mdx" {>= "1.9.0" & with-test}
] ]
build: [ build: [
["dune" "subst"] {dev} ["dune" "subst"] {dev}

View file

@ -22,6 +22,7 @@ let add_global_thread_loop_wrapper f : unit =
done done
let[@inline] run self f : unit = S_queue.push self.q f let[@inline] run self f : unit = S_queue.push self.q f
let size self = Array.length self.threads
let worker_thread_ ~on_exn (active : bool A.t) (q : _ S_queue.t) : unit = let worker_thread_ ~on_exn (active : bool A.t) (q : _ S_queue.t) : unit =
while A.get active do while A.get active do

View file

@ -33,6 +33,9 @@ val create :
to use for this pool's workers. to use for this pool's workers.
*) *)
val size : t -> int
(** Number of threads *)
val shutdown : t -> unit val shutdown : t -> unit
(** Shutdown the pool and wait for it to terminate. Idempotent. *) (** Shutdown the pool and wait for it to terminate. Idempotent. *)