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

Function reinit_locks_after_fork

crates/vm/src/stdlib/posix.rs:832–862  ·  view source on GitHub ↗
(vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

830 /// to unlocked by zeroing the raw lock bytes.
831 #[cfg(all(unix, feature = "threading"))]
832 fn reinit_locks_after_fork(vm: &VirtualMachine) {
833 use rustpython_common::lock::reinit_mutex_after_fork;
834
835 unsafe {
836 // PyGlobalState PyMutex locks
837 reinit_mutex_after_fork(&vm.state.before_forkers);
838 reinit_mutex_after_fork(&vm.state.after_forkers_child);
839 reinit_mutex_after_fork(&vm.state.after_forkers_parent);
840 reinit_mutex_after_fork(&vm.state.atexit_funcs);
841 reinit_mutex_after_fork(&vm.state.global_trace_func);
842 reinit_mutex_after_fork(&vm.state.global_profile_func);
843 reinit_mutex_after_fork(&vm.state.monitoring);
844
845 // PyGlobalState parking_lot::Mutex locks
846 reinit_mutex_after_fork(&vm.state.thread_frames);
847 reinit_mutex_after_fork(&vm.state.thread_handles);
848 reinit_mutex_after_fork(&vm.state.shutdown_handles);
849
850 // Context-level RwLock
851 vm.ctx.string_pool.reinit_after_fork();
852
853 // Codec registry RwLock
854 vm.state.codec_registry.reinit_after_fork();
855
856 // GC state (multiple Mutex + RwLock)
857 crate::gc_state::gc_state().reinit_after_fork();
858
859 // Import lock (RawReentrantMutex<RawMutex, RawThreadId>)
860 crate::stdlib::_imp::reinit_imp_lock_after_fork();
861 }
862 }
863
864 fn py_os_after_fork_parent(vm: &VirtualMachine) {
865 #[cfg(feature = "threading")]

Callers 1

py_os_after_fork_childFunction · 0.85

Calls 4

reinit_mutex_after_forkFunction · 0.85
gc_stateFunction · 0.85
reinit_after_forkMethod · 0.45

Tested by

no test coverage detected