mirror of
https://github.com/python/cpython.git
synced 2025-10-25 18:54:53 +00:00
gh-137514: Add a free-threading wrapper for mutexes (GH-137515)
Add `FT_MUTEX_LOCK`/`FT_MUTEX_UNLOCK`, which call `PyMutex_Lock` and `PyMutex_Unlock` on the free-threaded build, and no-op otherwise.
This commit is contained in:
parent
dec624e0af
commit
082f370cdd
9 changed files with 44 additions and 88 deletions
|
|
@ -907,13 +907,9 @@ unsignal_pending_calls(PyThreadState *tstate, PyInterpreterState *interp)
|
|||
static void
|
||||
clear_pending_handling_thread(struct _pending_calls *pending)
|
||||
{
|
||||
#ifdef Py_GIL_DISABLED
|
||||
PyMutex_Lock(&pending->mutex);
|
||||
FT_MUTEX_LOCK(&pending->mutex);
|
||||
pending->handling_thread = NULL;
|
||||
PyMutex_Unlock(&pending->mutex);
|
||||
#else
|
||||
pending->handling_thread = NULL;
|
||||
#endif
|
||||
FT_MUTEX_UNLOCK(&pending->mutex);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue