-
Notifications
You must be signed in to change notification settings - Fork 292
/
ThreadPoolScheduler.rakudoc
39 lines (26 loc) 路 1.36 KB
/
ThreadPoolScheduler.rakudoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
=begin pod :kind("Type") :subkind("class") :category("domain-specific")
=TITLE class ThreadPoolScheduler
=SUBTITLE Scheduler that distributes work among a pool of threads
=begin code :skip-test<compile time error>
class ThreadPoolScheduler does Scheduler {}
=end code
The C<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.
=head1 Methods
=head2 new
method new(Int :$initial_threads = 0, Int :$max_threads = 8 * cores)
Creates a new C<ThreadPoolScheduler> object with the given range of threads to
maintain.
The default value for C<:initial_threads> is B<0>, so no threads will be
started when a C<ThreadPoolScheduler> object is created by default.
The default value for C<:max_threads> is B<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 L<RAKUDO_MAX_THREADS|/programs/03-environment-variables#Other>
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
C<Inf> or C<*> as a value for C<:max_threads>, indicating that the maximum
number of threads allowed by the operating system, will be used.
=end pod