Expand description
Synchronization mechanisms based on the Python GIL.
With the acceptance of PEP 703 (aka a “freethreaded Python”) for Python 3.13, these are likely to undergo significant developments in the future.
Modules§
- once_lock_ 🔒ext_ sealed rustc_has_once_lock
Structs§
- GILOnceCell 
- A write-once primitive similar to std::sync::OnceLock<T>.
- GILProtectedNon- Py_GIL_DISABLED
- Value with concurrent access protected by the GIL.
- Interned 👻
- Implementation detail for intern!macro.
Traits§
- MutexExt 
- Extension trait for std::sync::Mutexwhich helps avoid deadlocks between the Python interpreter and acquiring theMutex.
- OnceExt
- Helper trait for Onceto help avoid deadlocking when using aOncewhen attached to a Python thread.
- OnceLock Ext rustc_has_once_lock
- Extension trait for std::sync::OnceLockwhich helps avoid deadlocks between the Python interpreter and initialization with theOnceLock.
Functions§
- init_once_ 🔒force_ py_ attached 
- init_once_ 🔒lock_ py_ attached rustc_has_once_lock
- init_once_ 🔒py_ attached 
- with_critical_ section 
- Executes a closure with a Python critical section held on an object.
- with_critical_ section2 
- Executes a closure with a Python critical section held on two objects.