What's the least terrible way to implement 'unwind all threads on panic'? I would like to have every thread (attempt to) gracefully die on panics and SIGINTs (and notice SIGKILLs?).
It doesn't appear there is a Rust way to interrupt threads, so I'm thinking that I would implement a trait akin to runOneStep
and have my threads check a boolean or look at libc interrupt handling.
I've seen How can I cause a panic on a thread to immediately end the main thread?, which is basically the hacky way of setting panic=abort
.
I've also seen Thread::cancel() support.