Struct scheduled_thread_pool::ScheduledThreadPool [−][src]
pub struct ScheduledThreadPool { /* fields omitted */ }
Expand description
A pool of threads which can run tasks at specific time intervals.
When the pool drops, all pending scheduled executions will be run, but periodic actions will not be rescheduled after that.
Implementations
Creates a new thread pool with the specified number of threads which will be named.
The substring {}
in the name will be replaced with an integer
identifier of the thread.
Panics
Panics if num_threads
is 0.
Executes a closure as soon as possible in the pool.
Executes a closure after a time delay in the pool.
Executes a closure after an initial delay at a fixed rate in the pool.
The rate includes the time spent running the closure. For example, if the rate is 5 seconds and the closure takes 2 seconds to run, the closure will be run again 3 seconds after it completes.
Panics
If the closure panics, it will not be run again.
Executes a closure after an initial delay at a dynamic rate in the pool.
The rate includes the time spent running the closure. For example, if the return rate is 5 seconds and the closure takes 2 seconds to run, the closure will be run again 3 seconds after it completes.
Panics
If the closure panics, it will not be run again.
Executes a closure after an initial delay at a fixed rate in the pool.
In contrast to execute_at_fixed_rate
, the execution time of the
closure is not subtracted from the delay before it runs again. For
example, if the delay is 5 seconds and the closure takes 2 seconds to
run, the closure will run again 5 seconds after it completes.
Panics
If the closure panics, it will not be run again.
Executes a closure after an initial delay at a dynamic rate in the pool.
In contrast to execute_at_dynamic_rate
, the execution time of the
closure is not subtracted from the returned delay before it runs again. For
example, if the delay is 5 seconds and the closure takes 2 seconds to
run, the closure will run again 5 seconds after it completes.
Panics
If the closure panics, it will not be run again.