-
Notifications
You must be signed in to change notification settings - Fork 556
Open
Description
use rayon::prelude::*;
use std::{thread, time::Duration};
fn run_workers(n: usize) {
(0..n)
.into_par_iter()
.panic_fuse() // <- stop others ASAP if any worker panics
.for_each(|i| {
loop {
println!("hi from thread: {i}");
thread::sleep(Duration::from_secs(1));
if i == 0 {
thread::sleep(Duration::from_secs(2));
panic!("oh no");
}
}
});
}
fn main() {
run_workers(10);
println!("cya")
}
from the docs i would expect this to terminate?
(im trying to have a worker system where we let the system crash when there is a panic, like single threaded rust)
Metadata
Metadata
Assignees
Labels
No labels