Skip to main content

lock

Function lock 

Source
pub fn lock<T>(mutex: &Mutex<T>) -> MutexGuard<'_, T>
Expand description

Take a lock, recovering from a panic that poisoned it.

A memo and a cache are optimizations. Turning a panic that happened elsewhere into a second panic here would be a bug of prov’s own making, and the worst that can actually be wrong behind a poisoned lock is a stale entry — which every caller already tolerates by construction.

Mutex rather than RefCell for the whole family: &Workspace must stay Send (prov/tests/public_api.rs pins that, so an embedder can drive apply and discover from a multi-threaded runtime), which needs the workspace itself to be Sync, which a RefCell is not. No guard is ever held across an .await.