INNER CODE UNIT · Rust
lock
c3rb3ru5d3d53c/binlex · crates/libvex/libvex-rs/src/lib.rs:283
fn lock(&self) -> LiftGuard<'_> {
let guard = self.0.lock();
*guard.borrow_mut() += 1;
LiftGuard(guard)
}
}
struct LiftGuard<'a>(ReentrantMutexGuard<'a, RefCell<u8>>);
impl Drop for LiftGuard<'_> {
fn drop(&mut self) {
*self.0.borrow_mut() -= 1;
}
}
lazy_static! {
static ref LIFT_LOCK: LiftLock = LiftLock::new();
}