Skip to main content

lock_or_log

Macro lock_or_log 

Source
macro_rules! lock_or_log {
    ($expr:expr, $ctx:literal) => { ... };
    ($expr:expr, $ctx:literal, $default:expr) => { ... };
}
Expand description

Lock helper for callers that cannot propagate Result<_, LaneError>.

Returns the guard on success; on poisoning logs an error and returns from the surrounding function. The optional second form returns a caller-provided default value (for non-() returning functions).

let mut res = lock_or_log!(self.gpu_resources.lock(), "MyLane::render");
let assets = lock_or_log!(meshes.read(), "MyLane::cost", 0.0);