Skip to content
Permalink
05de9a415c
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
29 lines (21 sloc) 610 Bytes
use std::collections::HashSet;
use parking_lot::Mutex;
use crate::Lazy;
type HS =
HashSet<&'static str, std::hash::BuildHasherDefault<fxhash::FxHasher64>>;
static ACTIVE: Lazy<Mutex<HS>, fn() -> Mutex<HS>> = Lazy::new(init);
fn init() -> Mutex<HS> {
Mutex::new(HS::default())
}
/// Returns `true` if the given failpoint is active.
pub fn is_active(name: &'static str) -> bool {
ACTIVE.lock().contains(&name)
}
/// Enable a particular failpoint
pub fn set(name: &'static str) {
ACTIVE.lock().insert(name);
}
/// Clear all active failpoints.
pub fn reset() {
ACTIVE.lock().clear();
}