pub struct OncePool { /* private fields */ }Expand description
A one-time-use thread pool.
This is not an actual thread pool, rather a configuration on number of threads to be spawned. Desired threads will be spawned just before the computation starts and will be released right after. Therefore, it may be considered as a one-time-use thread pool.
OncePool is used when the transient-pool feature is enabled.
In this configuration, “orx-parallel” does not create and hold on to a persistent thread pool.
Implementations§
Source§impl OncePool
impl OncePool
Sourcepub fn new(num_threads: impl Into<NumThreads>) -> Self
pub fn new(num_threads: impl Into<NumThreads>) -> Self
Assumes (*) a thread pool of num_threads threads.
Note that, this desired number of threads can be overwritten by the following:
- if the system has
n < num_threadsavailable threads, computation will usenthreads. - if ORX_NUM_THREADS environment variable exists with value
m < num_threads, computation will usemthreads.
(*) This is not an actual thread pool, rather a configuration on number of threads to be spawned. Desired threads will be spawned just before the computation starts and will be released right after. Therefore, it may be considered as a one-time-use thread pool.