Struct tdengine::ThreadPool
[−]
[src]
pub struct ThreadPool { /* fields omitted */ }
Methods
impl ThreadPool
[src]
fn new(n: usize) -> ThreadPool
Construct a threadpool with the given number of threads.
Minimum value is 1
.
fn new_with_name(n: usize, name: String) -> ThreadPool
fn thread_count(&self) -> usize
Returns the number of threads inside this pool.
fn execute<F>(&self, job: F) where
F: FnOnce() -> () + Send + 'static,
F: FnOnce() -> () + Send + 'static,
Executes the function job
on a thread in the pool.
fn join_all(&self)
fn active_count(&self) -> usize
Returns the number of currently active threads.
fn max_count(&self) -> usize
Returns the number of created threads
fn set_threads(&mut self, threads: usize) -> i32
Sets the number of threads to use as threads
.
Can be used to change the threadpool size during runtime