pub struct ThreadPool { /* private fields */ }
Expand description
A ThreadPool that runs the given task with the given threads. If all the threads are occupied then it waits until a new thread is available.
Implementations§
Source§impl ThreadPool
impl ThreadPool
Sourcepub fn new(size: usize) -> Self
pub fn new(size: usize) -> Self
Returns a new instce of ThreadPool. The ThreadPool::new() method takes an argument which is the number of threads the threadpool has.
§Examples
let pool = ThreadPool::new(4);
pub fn shutdown(&mut self)
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