pub unsafe fn zero_reinit_after_fork<T>(lock: *const T)Expand description
Reset a lock to its initial (unlocked) state by zeroing its bytes.
After fork(), any lock held by a now-dead thread would remain
permanently locked. We zero the raw bytes (the unlocked state for all
parking_lot raw lock types) instead of using the normal unlock path,
which would interact with stale waiter queues.
ยงSafety
Must only be called from the single-threaded child process immediately
after fork(), before any other thread is created.
The type T must represent the unlocked state as all-zero bytes
(true for parking_lot::RawMutex, RawRwLock, RawReentrantMutex, etc.).