pub struct Pool { /* private fields */ }
Expand description
A threadpool that acts as a handle to a number of threads spawned at construction.
Implementations§
§impl Pool
impl Pool
pub fn new(n: u32) -> Pool
pub fn new(n: u32) -> Pool
Construct a threadpool with the given number of threads.
Minimum value is 1
.
pub fn scoped<'pool, 'scope, F, R>(&'pool mut self, f: F) -> Rwhere
F: FnOnce(&Scope<'pool, 'scope>) -> R,
pub fn scoped<'pool, 'scope, F, R>(&'pool mut self, f: F) -> Rwhere F: FnOnce(&Scope<'pool, 'scope>) -> R,
Borrows the pool and allows executing jobs on other threads during that scope via the argument of the closure.
This method will block until the closure and all its jobs have run to completion.
pub fn thread_count(&self) -> u32
pub fn thread_count(&self) -> u32
Returns the number of threads inside this pool.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Pool
impl Send for Pool
impl !Sync for Pool
impl Unpin for Pool
impl !UnwindSafe for Pool
Blanket Implementations§
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.