Struct scheduled_executor::executor::ThreadPoolExecutor
[−]
[src]
pub struct ThreadPoolExecutor { /* fields omitted */ }
A ThreadPoolExecutor
will use one thread for the task scheduling and a thread pool for
task execution, allowing multiple tasks to run in parallel.
Methods
impl ThreadPoolExecutor
[src]
fn new(threads: usize) -> Result<ThreadPoolExecutor, Error>
Creates a new ThreadPoolExecutor
with the specified number of threads. Threads will
be named "pool_thread_0", "pool_thread_1" and so on.
fn with_prefix(
threads: usize,
prefix: &str
) -> Result<ThreadPoolExecutor, Error>
threads: usize,
prefix: &str
) -> Result<ThreadPoolExecutor, Error>
Creates a new ThreadPoolExecutor
with the specified number of threads and prefix for
the thread names.
fn with_executor(
threads: usize,
prefix: &str,
executor: CoreExecutor
) -> ThreadPoolExecutor
threads: usize,
prefix: &str,
executor: CoreExecutor
) -> ThreadPoolExecutor
Creates a new ThreadPoolExecutor
with the specified number of threads, prefix and
using the given CoreExecutor
for scheduling.
fn schedule_fixed_rate<F>(
&self,
initial: Duration,
interval: Duration,
scheduled_fn: F
) -> TaskHandle where
F: Fn(&Remote) + Send + Sync + 'static,
&self,
initial: Duration,
interval: Duration,
scheduled_fn: F
) -> TaskHandle where
F: Fn(&Remote) + Send + Sync + 'static,
Schedules the given function to be executed every interval
. The function will be
scheduled on one of the threads in the thread pool.
fn pool(&self) -> &CpuPool
Returns the thread pool used internally.
Trait Implementations
impl Clone for ThreadPoolExecutor
[src]
fn clone(&self) -> ThreadPoolExecutor
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more