Struct scoped_threadpool::Pool
source · pub struct Pool { /* private fields */ }
Expand description
A threadpool that acts as a handle to a number of threads spawned at construction.
Implementations§
source§impl Pool
impl Pool
sourcepub fn new(n: u32) -> Pool
pub fn new(n: u32) -> Pool
Construct a threadpool with the given number of threads.
Minimum value is 1
.
sourcepub fn scoped<'pool, 'scope, F, R>(&'pool mut self, f: F) -> R
pub fn scoped<'pool, 'scope, F, R>(&'pool mut self, f: F) -> 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.
sourcepub 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 Freeze for Pool
impl !RefUnwindSafe for Pool
impl Send for Pool
impl !Sync for Pool
impl Unpin for Pool
impl !UnwindSafe for Pool
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more