MCPcopy Index your code
hub / github.com/RustPython/RustPython / try_lock

Method try_lock

crates/common/src/lock/thread_mutex.rs:71–73  ·  view source on GitHub ↗

Returns `Some(true)` if able to successfully lock without blocking, `Some(false)` otherwise, and `None` when the mutex is already locked on the current thread.

(&self)

Source from the content-addressed store, hash-verified

69 /// Returns `Some(true)` if able to successfully lock without blocking, `Some(false)`
70 /// otherwise, and `None` when the mutex is already locked on the current thread.
71 pub fn try_lock(&self) -> Option<bool> {
72 self.lock_internal(|| self.mutex.try_lock())
73 }
74
75 /// Unlocks this mutex. The inner mutex may not be unlocked if
76 /// this mutex was acquired previously in the current thread.

Callers 5

fmtMethod · 0.45
collect_innerMethod · 0.45
get_itemMethod · 0.45
clearMethod · 0.45
traverseMethod · 0.45

Calls 2

lock_internalMethod · 0.80
ErrClass · 0.50

Tested by

no test coverage detected