Trait lib_wc::executors::ThreadPool
source · pub trait ThreadPool {
// Required methods
fn new(threads: usize) -> Result<Self>
where Self: Sized;
fn spawn<F>(&self, job: F)
where F: FnOnce() + Send + 'static;
fn shutdown(self);
}
Expand description
The trait that all thread pools should implement.
Required Methods§
sourcefn new(threads: usize) -> Result<Self>where
Self: Sized,
fn new(threads: usize) -> Result<Self>where Self: Sized,
Creates a new thread pool, immediately spawning the specified number of threads.
Returns an error if any thread fails to spawn. All previously-spawned threads are terminated.