Skip to main content

read_lock

Macro read_lock 

Source
macro_rules! read_lock {
    ($lock:expr) => { ... };
}
Expand description

Helper macro for acquiring a read lock.

On native targets, this awaits the async lock. On WASM, this uses the blocking (but single-threaded safe) lock.

§Lock Poisoning (WASM only)

On WASM targets, lock poisoning is recovered by taking the inner guard. This avoids panic-only behavior in adapter/runtime helpers.

§Example

let guard = read_lock!(self.data);
println!("{:?}", *guard);