Skip to main content

Guarded

Type Alias Guarded 

Source
pub type Guarded<Value> = GuardedBy<Value, Mutex>;
Expand description

A wrapper around a mutex, and a value protected by the mutex. This type uses bun_threading::Mutex internally.

Drop-in for parking_lot::Mutex<T>: const fn new(T), .lock() returns a guard with Deref/DerefMut, no poisoning.

Aliased Type§

pub struct Guarded<Value> {
    pub unsynchronized_value: UnsafeCell<Value>,
    /* private fields */
}

Fields§

§unsynchronized_value: UnsafeCell<Value>

The raw value. Don’t use this if there might be concurrent accesses.