pub struct PanicMonitor { /* private fields */ }
Expand description
A list of all threads which have panicked, with the ability to notify interested parties when this list is updated.
Implementations§
Source§impl PanicMonitor
impl PanicMonitor
Sourcepub fn new() -> PanicMonitor
pub fn new() -> PanicMonitor
Create a new PanicMonitor
.
Call this inside a lazy_static
block. You must call init
after this.
Sourcepub fn init(&'static self)
pub fn init(&'static self)
Initialise the PanicMonitor
.
Call this method as early as you can: a thread which panics before the PanicMonitor
is
initialised will not trigger wake-ups. Calling init
multiple times is relatively
harmless.
Sourcepub fn wait(&self, watch_list: &[ThreadId]) -> Vec<Thread>
pub fn wait(&self, watch_list: &[ThreadId]) -> Vec<Thread>
Block the current thread until one of the watched threads panics. The returned vector is always non-empty.
Note that this function returns as soon as one or more of the threads on the watch list has panicked. This means that if you specify a thread which has already panicked, this function will return immediately. Think of it as level-triggered, not edge-triggered.