Struct panic_monitor::PanicMonitor
[−]
[src]
pub struct PanicMonitor { /* fields omitted */ }
A list of all threads which have panicked, with the ability to notify interested parties when this list is updated.
Methods
impl PanicMonitor
[src]
pub fn new() -> PanicMonitor
[src]
Create a new PanicMonitor
.
Call this inside a lazy_static
block. You must call init
after this.
pub fn init(&'static self)
[src]
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.
pub fn wait(&self, watch_list: &[ThreadId]) -> Vec<Thread>
[src]
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.
pub fn wait_timeout(
&self,
watch_list: &[ThreadId],
dur: Duration
) -> Vec<Thread>
[src]
&self,
watch_list: &[ThreadId],
dur: Duration
) -> Vec<Thread>
Block the current thread until one of the watched threads panic, or the timeout expires. The returned vector is empty if and only if the timeout expired.
See wait
for more information.
pub fn check(&self, watch_list: &[ThreadId]) -> Vec<Thread>
[src]
Check if any of the specified threads have panicked. This function may block, but only very briefly. The returned vector may be empty.
See wait
for more information.