pub struct ThreadPool { /* private fields */ }Implementations§
Source§impl ThreadPool
impl ThreadPool
Sourcepub fn new(size: usize) -> Self
pub fn new(size: usize) -> Self
Basic thread pool implementation.
Create a new ThreadPool with the given size.
pub fn group_submit(&self, wg: &WaitGroup, f: impl FnOnce() + Send + 'static)
Sourcepub fn submit<F>(&self, f: F)
pub fn submit<F>(&self, f: F)
Execute a job in the thread pool. This is a ‘fire and forget’ method.
Sourcepub fn submit_with_result<F, T>(&self, f: F) -> WorkResult<T>
pub fn submit_with_result<F, T>(&self, f: F) -> WorkResult<T>
Execute a job in the thread pool and return a WorkResult that can be used to get the result of the job.
pub fn num_workers(&self) -> usize
pub fn is_alive(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ThreadPool
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