Trait hotdrink_rs::thread::ThreadPool [−][src]
pub trait ThreadPool { type NewError: Debug; type ExecError: Debug; fn new(initial: usize) -> Result<Self, Self::NewError>
where
Self: Sized; fn execute(
&mut self,
f: impl FnOnce() + Send + 'static
) -> Result<TerminationHandle, Self::ExecError>; }
A trait for thread pool implementations.
Associated Types
type NewError: Debug
[src]
An error for when a new thread pool could not be constructed.
type ExecError: Debug
[src]
An error for when executing a task on the thread pool fails.
Required methods
fn new(initial: usize) -> Result<Self, Self::NewError> where
Self: Sized,
[src]
Self: Sized,
Creates a new thread pool with the specified number of initial workers.
fn execute(
&mut self,
f: impl FnOnce() + Send + 'static
) -> Result<TerminationHandle, Self::ExecError>
[src]
&mut self,
f: impl FnOnce() + Send + 'static
) -> Result<TerminationHandle, Self::ExecError>
Executes some work using the workers in the thread pool.
Implementors
Loading content...