Function executors::crossbeam_workstealing_pool::pool_with_auto_parker[][src]

pub fn pool_with_auto_parker(threads: usize) -> ThreadPool<DynParker>

Creates a new thread pool capable of executing threads number of jobs concurrently.

Decides on the parker implementation automatically, but relies on dynamic dispatch to abstract over the chosen implementation, which comes with a slight performance cost.

Panics

This function will panic if threads is 0.

Examples

Create a new thread pool capable of executing four jobs concurrently:

use executors::*;
use executors::crossbeam_workstealing_pool;

let pool = crossbeam_workstealing_pool::pool_with_auto_parker(4);