pub struct Pool { /* private fields */ }
Expand description
Holds a number of threads that you can run tasks on
Implementations
sourceimpl Pool
impl Pool
sourcepub fn new() -> Pool
pub fn new() -> Pool
Spawn a pool with the native number of threads and a fixed backlog
The native number of threads is the number of logical cpus
according to the crate num_cpus
The backlog, 4 times the number of threads, is the number of
unprocessed jobs that are allowed to accumulate from
Scope::execute
sourcepub fn unbounded() -> Pool
pub fn unbounded() -> Pool
Spawn a pool with the native number of threads an un unbounded backlog
The native number of threads is the number of logical cpus
according to the crate num_cpus
Scope::execute
will never block
and will accumulate any task you give it. This may require a lot of memory.
sourcepub fn new_threads(nthreads: usize, backlog: usize) -> Pool
pub fn new_threads(nthreads: usize, backlog: usize) -> Pool
Spawn a number of threads. The pool’s queue of pending jobs is limited.
backlog
is the number of jobs that haven’t been run.
If specified, Scope::execute
will block
until a job completes.
sourcepub fn new_threads_unbounded(nthreads: usize) -> Pool
pub fn new_threads_unbounded(nthreads: usize) -> Pool
Spawn a number of threads. The pool’s queue of pending jobs is limited.
the backlog is unbounded as in unbounded
.