pub fn simple_func_worker(
    func: impl Fn(usize) + Sync + Send + 'static
) -> impl SystemWork
Expand description

Begin creating a system which calls the given function from each thread, passing the thread’s index.

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