diff --git a/crates/vm/src/stdlib/posix.rs b/crates/vm/src/stdlib/posix.rs index 7076e42b9a5..febb3af9b0d 100644 --- a/crates/vm/src/stdlib/posix.rs +++ b/crates/vm/src/stdlib/posix.rs @@ -759,6 +759,7 @@ pub mod module { reinit_mutex_after_fork(&vm.state.atexit_funcs); reinit_mutex_after_fork(&vm.state.global_trace_func); reinit_mutex_after_fork(&vm.state.global_profile_func); + reinit_mutex_after_fork(&vm.state.monitoring); // PyGlobalState parking_lot::Mutex locks reinit_mutex_after_fork(&vm.state.thread_frames); diff --git a/crates/vm/src/stdlib/thread.rs b/crates/vm/src/stdlib/thread.rs index 00068705ada..a3ff23cf234 100644 --- a/crates/vm/src/stdlib/thread.rs +++ b/crates/vm/src/stdlib/thread.rs @@ -987,8 +987,8 @@ pub(crate) mod _thread { #[cfg(unix)] fn reinit_parking_lot_mutex(mutex: &parking_lot::Mutex) { unsafe { - let ptr = mutex as *const parking_lot::Mutex as *mut u8; - core::ptr::write_bytes(ptr, 0, core::mem::size_of::()); + let raw = mutex.raw() as *const parking_lot::RawMutex as *mut u8; + core::ptr::write_bytes(raw, 0, core::mem::size_of::()); } }