mirror of
https://github.com/python/cpython.git
synced 2025-10-24 10:23:58 +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
|
|
@ -1689,9 +1689,7 @@ PyThreadState_Clear(PyThreadState *tstate)
|
|||
"PyThreadState_Clear: warning: thread still has a generator\n");
|
||||
}
|
||||
|
||||
#ifdef Py_GIL_DISABLED
|
||||
PyMutex_Lock(&_PyRuntime.ceval.sys_trace_profile_mutex);
|
||||
#endif
|
||||
FT_MUTEX_LOCK(&_PyRuntime.ceval.sys_trace_profile_mutex);
|
||||
|
||||
if (tstate->c_profilefunc != NULL) {
|
||||
tstate->interp->sys_profiling_threads--;
|
||||
|
|
@ -1702,9 +1700,7 @@ PyThreadState_Clear(PyThreadState *tstate)
|
|||
tstate->c_tracefunc = NULL;
|
||||
}
|
||||
|
||||
#ifdef Py_GIL_DISABLED
|
||||
PyMutex_Unlock(&_PyRuntime.ceval.sys_trace_profile_mutex);
|
||||
#endif
|
||||
FT_MUTEX_UNLOCK(&_PyRuntime.ceval.sys_trace_profile_mutex);
|
||||
|
||||
Py_CLEAR(tstate->c_profileobj);
|
||||
Py_CLEAR(tstate->c_traceobj);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue