does Scheduler
The ThreadPoolScheduler
has a range of number of threads that it maintains, and it distributes work among those threads. When the upper limit of threads isn't reached yet, and there is work pending, it spawns new threads to handle the work.
Methods§
new§
method new(Int : = 0, Int : = 8 * Kernel.cpu-cores)
Creates a new ThreadPoolScheduler
object with the given range of threads to maintain.
The default value for :initial_threads
is 0, so no threads will be started when a ThreadPoolScheduler
object is created by default.
The default value for :max_threads
is 64, unless there appear to be more than 8 CPU cores available. In that case the default will be 8 times the number of CPU cores.
See also the RAKUDO_MAX_THREADS environment variable to set the default maximum number of threads.
As of release 2022.06 of the Rakudo compiler, it is also possible to specify Inf
or *
as a value for :max_threads
, indicating that the maximum number of threads allowed by the operating system, will be used.