mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
feat: add Moonpool.recommended_thread_count
This commit is contained in:
parent
37f8c1059c
commit
f6a2e9a0ad
2 changed files with 8 additions and 0 deletions
|
|
@ -2,6 +2,8 @@ let start_thread_on_some_domain f x =
|
||||||
let did = Random.int (D_pool_.n_domains ()) in
|
let did = Random.int (D_pool_.n_domains ()) in
|
||||||
D_pool_.run_on_and_wait did (fun () -> Thread.create f x)
|
D_pool_.run_on_and_wait did (fun () -> Thread.create f x)
|
||||||
|
|
||||||
|
let recommended_thread_count () = Domain_.recommended_number ()
|
||||||
|
|
||||||
module Atomic = Atomic_
|
module Atomic = Atomic_
|
||||||
module Blocking_queue = Bb_queue
|
module Blocking_queue = Bb_queue
|
||||||
module Bounded_queue = Bounded_queue
|
module Bounded_queue = Bounded_queue
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,12 @@ val start_thread_on_some_domain : ('a -> unit) -> 'a -> Thread.t
|
||||||
to run the thread. This ensures that we don't always pick the same domain
|
to run the thread. This ensures that we don't always pick the same domain
|
||||||
to run all the various threads needed in an application (timers, event loops, etc.) *)
|
to run all the various threads needed in an application (timers, event loops, etc.) *)
|
||||||
|
|
||||||
|
val recommended_thread_count : unit -> int
|
||||||
|
(** Number of threads recommended to saturate the CPU.
|
||||||
|
For IO pools this makes little sense (you might want more threads than
|
||||||
|
this because many of them will be blocked most of the time).
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
module Lock = Lock
|
module Lock = Lock
|
||||||
module Fut = Fut
|
module Fut = Fut
|
||||||
module Chan = Chan
|
module Chan = Chan
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue