Skip to main content

read

Function read 

Source
pub fn read<T: Send + Sync + 'static>(
    lock: &Arc<RwLock<T>>,
    context: &str,
) -> Option<OwnedRwLockReadGuard<T>>
Expand description

Acquire a read lock via a non-blocking spin loop with an adaptive timeout.

Unlike the previous Handle::block_on approach, this never parks a blocking thread waiting for the async runtime to make progress — eliminating the stall-under-load anti-pattern on Windows (#1018). The loop yields the thread between attempts so it does not starve other work on the blocking pool.

Returns None on timeout, preserving the historical default behavior.