1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Panic-related functions.

/// A guard that will abort the process if dropped while panicking.
///
/// This is to ensure that the runtime will terminate in case there is
/// a panic encountered during dispatch and the runtime is built with
/// a non-abort panic handler.
pub struct AbortOnPanic;

impl Drop for AbortOnPanic {
    fn drop(&mut self) {
        if std::thread::panicking() {
            crate::common::process::abort();
        }
    }
}