a3s-code-core 9.0.0

A3S Code Core - Embeddable AI agent library with tool execution
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Hermetic mutex-poison helper for coverage tests.
//!
//! Kept outside F-table kernels so `panic` / `resume_unwind` expansions do not
//! dilute `--no-cfg-coverage` JSON line scoring for production modules.

use std::sync::Mutex;

/// Poison `mutex` by panicking while a guard is held, catching the unwind.
pub(crate) fn poison_mutex<T>(mutex: &Mutex<T>) {
    let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
        let _guard = mutex.lock().expect("mutex lock");
        std::panic::resume_unwind(Box::new("intentional mutex poison for test"));
    }));
}