Module sync

Source
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§

GILOnceCell
A write-once primitive similar to std::sync::OnceLock<T>.
GILProtected
Value with concurrent access protected by the GIL.

Traits§

MutexExt
Extension trait for std::sync::Mutex which helps avoid deadlocks between the Python interpreter and acquiring the Mutex.
OnceExt
Helper trait for Once to help avoid deadlocking when using a Once when attached to a Python thread.
OnceLockExt
Extension trait for std::sync::OnceLock which helps avoid deadlocks between the Python interpreter and initialization with the OnceLock.

Functions§

with_critical_section
Executes a closure with a Python critical section held on an object.