Skip to main content

write_lock

Macro write_lock 

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

Helper macro for acquiring a write 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 mut guard = write_lock!(self.data);
*guard = new_value;