Function dynpool::with_threads

source ·
pub fn with_threads(w: impl SystemWork, threads: usize) -> impl SettableSystem
Expand description

Create a system that has a set number of active workers.

// Run 10 threads for 0.5 seconds.
let time = Instant::now() + Duration::from_millis(500);
let worker = simple_func_worker(|index| println!("Hello from {}", index));
let sys = shutdown_after(with_threads(worker, 10), time);
Pool::start_fg(sys);