Trait hotdrink_rs::thread::ThreadPool[][src]

pub trait ThreadPool {
    type NewError: Debug;
    type ExecError: Debug;
    fn new(
        initial: usize,
        termination_strategy: TerminationStrategy
    ) -> 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.

Loading content...

Required methods

fn new(
    initial: usize,
    termination_strategy: TerminationStrategy
) -> Result<Self, Self::NewError> where
    Self: Sized
[src]

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]

Executes some work using the workers in the thread pool.

Loading content...

Implementors

impl ThreadPool for DummyPool[src]

type NewError = bool

type ExecError = bool

Loading content...