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

Method try_lock

crates/common/src/lock/cell_lock.rs:32–39  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

30
31 #[inline]
32 fn try_lock(&self) -> bool {
33 if self.is_locked() {
34 false
35 } else {
36 self.locked.set(true);
37 true
38 }
39 }
40
41 unsafe fn unlock(&self) {
42 self.locked.set(false)

Callers

nothing calls this directly

Calls 2

is_lockedMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected