[−][src]Trait futures_cputask::SyncThreadPool
ThreadPool trait
SyncThreadPool
has to be implemented for any kind of underlying threadpool you want to use
with this crate. It defines the minimum interface required to be useful.
This crate implements this trait on the threadpool
and uvth
crates, if their corresponding
features are enabled.
Required methods
fn new() -> Self
Create a new default thread pool
The implementor is suggested to dynamically check the amount of processing units available and spawn that many threads for threadpool usage.
fn with_thread_count(num_threads: usize) -> Self
Creates a new thread pool with a maximum of num_threads
threads
The implementor shall not execute more than num_threads
jobs at the same time, unless
modified. Internal threads that manage the job threads are not counted towards that limit.
fn execute<F>(&self, fun: F) where
F: FnOnce() + Send + 'static,
F: FnOnce() + Send + 'static,
Schedules a task on the threadpool
As soon as the task is scheduled, this function shall return.
Implementations on Foreign Types
impl SyncThreadPool for ThreadPool
[src]
fn new() -> Self
[src]
fn with_thread_count(num_threads: usize) -> Self
[src]
fn execute<F>(&self, fun: F) where
F: FnOnce() + Send + 'static,
[src]
F: FnOnce() + Send + 'static,
impl SyncThreadPool for ThreadPool
[src]
fn new() -> Self
[src]
fn with_thread_count(num_threads: usize) -> Self
[src]
fn execute<F>(&self, fun: F) where
F: FnOnce() + Send + 'static,
[src]
F: FnOnce() + Send + 'static,