Struct anor_utils::threadpool::ThreadPool
source · pub struct ThreadPool { /* private fields */ }Implementations§
source§impl ThreadPool
impl ThreadPool
sourcepub fn new(size: usize) -> ThreadPool
pub fn new(size: usize) -> ThreadPool
Create a new ThreadPool.
The size is the number of threads in the pool.
Panics
The new function will panic if the size is zero.
pub fn execute<F>(&self, f: F)where F: FnOnce() + Send + 'static,
sourcepub fn wait_for_completion(&self)
pub fn wait_for_completion(&self)
blocks the executor and waits for the completion of active jobs
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ThreadPool
impl Send for ThreadPool
impl Sync for ThreadPool
impl Unpin for ThreadPool
impl !UnwindSafe for ThreadPool
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