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

Method lock

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

Blocks for the mutex to be available, and returns true if the mutex isn't already locked on the current thread.

(&self)

Source from the content-addressed store, hash-verified

47 /// Blocks for the mutex to be available, and returns true if the mutex isn't already
48 /// locked on the current thread.
49 pub fn lock(&self) -> bool {
50 self.lock_internal(|| {
51 self.mutex.lock();
52 true
53 })
54 .is_some()
55 }
56
57 /// Like `lock()` but wraps the blocking wait in `wrap_fn`.
58 /// The caller can use this to detach thread state while waiting.

Callers 1

lock_wrappedMethod · 0.45

Calls 2

lock_internalMethod · 0.80
SomeClass · 0.50

Tested by

no test coverage detected