You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make multiprocessing SemLock thread-safe in the free-threaded build #117435
The multiprocessing SemLock code maintains an internal count field. When operating as a recursive mutex, count is the number of times the thread has acquired the mutex (i.e., 0, 1, .. N). When operating as a semaphore, count is often 0 or 1, but can be negative if the SemLock is initialized with maxvalue > 1
The modification of count is not thread-safe without the GIL within the process. Note that the count field is not shared across processes, unlike the underlying sem_t or HANDLE.
In particular, the modification of count after the semaphore is released is not thread-safe without the GIL:
changed the title [-]Make multiprocessing semaphore thread-safe in the free-threaded build[/-][+]Make multiprocessing `SemLock` thread-safe in the free-threaded build[/+]on Apr 1, 2024
Activity
[-]Make multiprocessing semaphore thread-safe in the free-threaded build[/-][+]Make multiprocessing `SemLock` thread-safe in the free-threaded build[/+]pythongh-117435: Make `SemLock` thread-safe in free-threaded build
Merge branch 'pythongh-117435-semlock' into nogil-integration
Merge branch 'pythongh-117435-semlock' into nogil-integration
gh-117435: Make `SemLock` thread-safe in free-threaded build (#117436)
pythongh-117435: Make `SemLock` thread-safe in free-threaded build (p…