use std::cell::Cell;
thread_local! {
static BOOTSTRAPPED: Cell<bool> = Cell::new(false);
static OBSERVER_ACTIVE: Cell<bool> = Cell::new(false);
}
pub fn mark_bootstrapped() -> bool {
BOOTSTRAPPED.with(|b| {
if b.get() { return false; }
b.set(true);
true
})
}
pub fn reset_bootstrap() {
BOOTSTRAPPED.with(|b| b.set(false));
}
pub fn mark_observer_active() -> bool {
OBSERVER_ACTIVE.with(|o| {
if o.get() { return false; }
o.set(true);
true
})
}
pub fn is_bootstrapped() -> bool {
BOOTSTRAPPED.with(|b| b.get())
}
pub fn is_observer_active() -> bool {
OBSERVER_ACTIVE.with(|o| o.get())
}