Struct scope_threadpool::Scope
[−]
[src]
pub struct Scope<'pool, 'scope, StateMaker, State> where
StateMaker: Fn() -> State + 'static + Send + Sync,
State: 'static, { /* fields omitted */ }Represents the current scope, you can execute functions in it.
Methods
impl<'pool, 'scope, StateMaker, State> Scope<'pool, 'scope, StateMaker, State> where
StateMaker: Fn() -> State + Send + Sync, [src]
StateMaker: Fn() -> State + Send + Sync,
fn execute<F>(&self, f: F) where
F: FnOnce(&mut State) + Send + 'scope, [src]
F: FnOnce(&mut State) + Send + 'scope,
Execute a job on one of the threads in the threadpool.
The closure is called from one of the threads. If the threadpool has a specified backlog, then this function blocks until the threadpool finishes a job.
The closure is passed a mutable reference to the
the state produced by the function passed to Pool::new
This function may panic if a job that was previously
executed has panicked. This way, your program terminates
as soon as a panic occurs. If you don't call this function
again after a panic occurs, then Pool::scoped
will panic before it completes.