Quansight-Labs / free-threaded-compatibility

A central repository to keep track of the status of work on and support for free-threaded CPython (see PEP 703), with a focus on the scientific and ML/AI ecosystem
MIT License
28 stars 5 forks source link

Availability of PyMutex to implement locking for thread-safety #6

Open rgommers opened 2 months ago

rgommers commented 2 months ago

Relevant discussions for making PyMutex public in CPython for 3.13:

The second link notes some current alternatives, like PyThreadType_lock or platform-specific locks.

ngoldbaum commented 1 month ago

The C API working group decided to expose PyMutex in the C API https://github.com/capi-workgroup/decisions/issues/22#issuecomment-2155148479. We’re after the code freeze so it will take a special decision from the release manager for it to be included in 3.13 but it will definitely be in 3.14.

colesbury commented 2 weeks ago

PyMutex, PyMutex_Lock(), and PyMutex_Unlock() are now public in 3.13 (will be available in beta 3).

colesbury commented 2 weeks ago

Also the critical section API (i.e., Py_BEGIN_CRITICAL_SECTION() is now available publicly)