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

Function reinit_after_fork

crates/vm/src/stdlib/_imp.rs:57–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55 /// Must only be called from single-threaded child after fork().
56 #[cfg(unix)]
57 pub(crate) unsafe fn reinit_after_fork() {
58 if IMP_LOCK.is_locked() && !IMP_LOCK.is_owned_by_current_thread() {
59 // Held by a dead thread — reset to unlocked.
60 unsafe { rustpython_common::lock::zero_reinit_after_fork(&IMP_LOCK) };
61 }
62 }
63
64 /// Match CPython's `_PyImport_ReInitLock()` + `_PyImport_ReleaseLock()`
65 /// behavior in the post-fork child:

Callers 2

Calls 2

zero_reinit_after_forkFunction · 0.85
is_lockedMethod · 0.80

Tested by

no test coverage detected