1
2
3
4
5
6
7
8
9
10
11
12
13
//! Utilities for implementing epilogues.
//!
//! Epilogues are operations that are done when several other operations are done.

use std::sync::atomic::{AtomicUsize, Ordering};

/// A debugging method for detecting the case when the epilogue is never executed.
pub fn debug_assert_counter_zero(counter: &AtomicUsize, what: &'static str) {
    let value = counter.load(Ordering::SeqCst);
    if value != 0 {
        panic!("{what} is still {value}.");
    }
}