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.
Structs§
- GILOnce
Cell Deprecated - A write-once primitive similar to
std::sync::OnceLock<T>. - GILProtected
Deprecated - Value with concurrent access protected by the GIL.
- PyOnce
Lock - An equivalent to
std::sync::OnceLockfor initializing objects while attached to the Python interpreter.
Traits§
- Mutex
Ext - Extension trait for
std::sync::Mutexwhich helps avoid deadlocks between the Python interpreter and acquiring theMutex. - OnceExt
- Extension trait for
Onceto help avoid deadlocking when using aOncewhen attached to a Python thread. - Once
Lock Ext - Extension trait for
std::sync::OnceLockwhich helps avoid deadlocks between the Python interpreter and initialization with theOnceLock.
Functions§
- 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.