Skip to main content

mutex_lock

Macro mutex_lock 

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

Helper macro for acquiring a mutex 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 = mutex_lock!(self.state);
process(&*guard);