[−][src]Trait threads_pool::Hibernation
Required methods
Loading content...Implementors
impl Hibernation for ThreadPool
[src]
fn hibernate(&mut self)
[src]
Put the pool into hibernation mode. In this mode, all workers will park itself after finishing the current job to reduce CPU usage.
The pool will be prompted back to normal mode on 2 occasions:
- calling the
unhibernate
API to wake up the pool, or 2) sending a new job through theexec
API, which will automatically assume an unhibernation desire, wake self up, take and execute the incoming job. Though if you call the immutable APIexecute
, the job will be queued yet not executed. Be aware that if the queue is full, the new job will be dropped and an execution error will be returned in this case.
It is recommended to explicitly call unhibernate
when the caller want to wake up the pool,
to avoid side effect or undefined behaviors.
fn unhibernate(&mut self)
[src]
This will unhibernate the pool if it's currently in the hibernation mode. It will do nothing if the pool is in any other operating mode, e.g. the working mode or shutting down mode.
Cautious: calling this API will set the status flag to normal, which may conflict with actions that would set status flag otherwise.
fn is_hibernating(&self) -> bool
[src]
Check if the pool is in hibernation mode.