[−][src]Trait threads_pool::ThreadPoolStates
Required methods
fn set_exec_timeout(&mut self, timeout: Option<Duration>)
fn get_exec_timeout(&self) -> Option<Duration>
fn toggle_auto_scale(&mut self, auto_scale: bool)
fn auto_scale_enabled(&self) -> bool
Implementors
impl ThreadPoolStates for ThreadPool
[src]
fn set_exec_timeout(&mut self, timeout: Option<Duration>)
[src]
Set the job timeout period.
The timeout period is mainly for dropping jobs when the thread pool is under
pressure, i.e. the producer creates new work faster than the consumer can handle them. When
the job queue buffer is full, any additional jobs will be dropped after the timeout period.
Set the timeout
parameter to None
to turn this feature off, which is the default behavior.
Note that if the timeout is turned off, sending new jobs to the full pool will block the
caller until some space is freed up in the work queue.
fn get_exec_timeout(&self) -> Option<Duration>
[src]
Check the currently set timeout period. If the result is None
, it means we will not timeout
on submitted jobs when the job queue is full, which implies the caller will be blocked until
some space in the queue is freed up
fn toggle_auto_scale(&mut self, auto_scale: bool)
[src]
Toggle if we shall scale the pool automatically when the pool is under pressure, i.e. adding more threads to the pool to take the jobs. These temporarily added threads will go away once the pool is able to keep up with the new jobs to release resources.
fn auto_scale_enabled(&self) -> bool
[src]
Check if the auto-scale feature is turned on or not