MCPcopy Index your code
hub / github.com/AI45Lab/Code / read_or_recover

Function read_or_recover

core/src/error.rs:96–98  ·  view source on GitHub ↗

Acquire a read guard, recovering from poison if the lock was poisoned. Non-security code should never panic on a poisoned lock. The data may be in an inconsistent state, but crashing the entire process is worse than serving stale data in a coding agent context.

(lock: &std::sync::RwLock<T>)

Source from the content-addressed store, hash-verified

94/// be in an inconsistent state, but crashing the entire process is worse
95/// than serving stale data in a coding agent context.
96pub(crate) fn read_or_recover<T>(lock: &std::sync::RwLock<T>) -> std::sync::RwLockReadGuard<'_, T> {
97 lock.read().unwrap_or_else(|p| p.into_inner())
98}
99
100/// Acquire a write guard, recovering from poison if the lock was poisoned.
101///

Callers 15

getMethod · 0.85
listMethod · 0.85
list_visibleMethod · 0.85
existsMethod · 0.85
lenMethod · 0.85
list_versionsMethod · 0.85
reportsMethod · 0.85
saveMethod · 0.85
from_historyMethod · 0.85
command_messagesFunction · 0.85

Calls

no outgoing calls

Tested by 2