Expand description
Synchronization mechanisms which are aware of the existence of the Python interpreter.
The Python interpreter has multiple βstop the worldβ situations which may block threads, such as
- The Python global interpreter lock (GIL), on GIL-enabled builds of Python, or
- The Python garbage collector (GC), which pauses attached threads during collection.
To avoid deadlocks in these cases, threads should take care to be detached from the Python interpreter before performing operations which might block waiting for other threads attached to the Python interpreter.
This module provides synchronization primitives which are able to synchronize under these conditions.
Re-exportsΒ§
pub use self::once_lock::PyOnceLock;
ModulesΒ§
- critical_
section - Wrappers for the Python critical section API
- once_
lock π - once_
lock_ πext_ sealed - rwlock_
ext_ πsealed
StructsΒ§
- GILOnce
Cell πDeprecated - Interned π»
- Implementation detail for
intern!macro.
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. - RwLock
Ext - Extension trait for
std::sync::RwLockwhich helps avoid deadlocks between the Python interpreter and acquiring theRwLock.
FunctionsΒ§
- init_
once_ πforce_ py_ attached - init_
once_ πlock_ py_ attached - init_
once_ πpy_ attached - with_
critical_ section Deprecated - Deprecated alias for
pyo3::sync::critical_section::with_critical_section - with_
critical_ section2 Deprecated - Deprecated alias for
pyo3::sync::critical_section::with_critical_section2