mirror of
https://github.com/python/cpython.git
synced 2025-08-26 19:55:24 +00:00
gh-114940: Add _Py_FOR_EACH_TSTATE_UNLOCKED(), and Friends (gh-127077)
This is a precursor to the actual fix for gh-114940, where we will change these macros to use the new lock. This change is almost entirely mechanical; the exceptions are the loops in codeobject.c and ceval.c, which now hold the "head" lock. Note that almost all of the uses of _Py_FOR_EACH_TSTATE_UNLOCKED() here will change to _Py_FOR_EACH_TSTATE_BEGIN() once we add the new per-interpreter lock.
This commit is contained in:
parent
bf542f8bb9
commit
9dabace39d
9 changed files with 79 additions and 87 deletions
|
@ -1006,13 +1006,10 @@ set_global_version(PyThreadState *tstate, uint32_t version)
|
|||
|
||||
#ifdef Py_GIL_DISABLED
|
||||
// Set the version on all threads in free-threaded builds.
|
||||
_PyRuntimeState *runtime = &_PyRuntime;
|
||||
HEAD_LOCK(runtime);
|
||||
for (tstate = interp->threads.head; tstate;
|
||||
tstate = PyThreadState_Next(tstate)) {
|
||||
_Py_FOR_EACH_TSTATE_BEGIN(interp, tstate) {
|
||||
set_version_raw(&tstate->eval_breaker, version);
|
||||
};
|
||||
HEAD_UNLOCK(runtime);
|
||||
_Py_FOR_EACH_TSTATE_END(interp);
|
||||
#else
|
||||
// Normal builds take the current version from instrumentation_version when
|
||||
// attaching a thread, so we only have to set the current thread's version.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue