MCPcopy Create free account
hub / github.com/RustPython/RustPython / reinit_after_fork

Method reinit_after_fork

crates/common/src/lock/thread_mutex.rs:95–101  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

93 /// after `fork()`, before any other thread is created.
94 #[cfg(unix)]
95 pub unsafe fn reinit_after_fork(&self) {
96 self.owner.store(0, Ordering::Relaxed);
97 unsafe {
98 let mutex_ptr = &self.mutex as *const R as *mut u8;
99 core::ptr::write_bytes(mutex_ptr, 0, core::mem::size_of::<R>());
100 }
101 }
102}
103
104unsafe impl<R: RawMutex + Send, G: GetThreadId + Send> Send for RawThreadMutex<R, G> {}

Callers 1

Calls 1

storeMethod · 0.45

Tested by

no test coverage detected