Function dynpool::shutdown_after

source ·
pub fn shutdown_after(sys: impl System, after: Instant) -> impl System
Expand description

Create a system wrapper which will shutdown after the provided time.

// 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);