Struct scope_threadpool::Pool
[−]
[src]
pub struct Pool<StateMaker, State> { /* fields omitted */ }Holds a number of threads that you can run tasks on
Methods
impl<StateMaker, State> Pool<StateMaker, State> where
StateMaker: Fn() -> State + 'static + Send + Sync,
State: 'static, [src]
StateMaker: Fn() -> State + 'static + Send + Sync,
State: 'static,
fn new(nthreads: usize, state_maker: StateMaker) -> Pool<StateMaker, State>[src]
Spawn a number of threads each of which call a state making function.
fn new_with_backlog(
nthreads: usize,
backlog: usize,
state_maker: StateMaker
) -> Pool<StateMaker, State>[src]
nthreads: usize,
backlog: usize,
state_maker: StateMaker
) -> Pool<StateMaker, State>
Spawn a number of threads. The pool's queue of pending jobs is limited.
backlog is the number of jobs that haven't been run.
If specified, Scope::execute will block
until a job completes.
state_maker is a function that is run on each thread and creates
an object, owned by that thread, which is passed to the jobs' closures.
fn scoped<F>(&mut self, f: F) where
F: FnOnce(Scope<StateMaker, State>), [src]
F: FnOnce(Scope<StateMaker, State>),
Store the current scope so that you can run jobs in it.
This function panics if the given closure or any threads panic.
Does not return until all executed jobs complete.