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:
@@ -977,25 +977,19 @@ make_pending_calls(PyThreadState *tstate)
|
||||
void
|
||||
_Py_set_eval_breaker_bit_all(PyInterpreterState *interp, uintptr_t bit)
|
||||
{
|
||||
_PyRuntimeState *runtime = &_PyRuntime;
|
||||
|
||||
HEAD_LOCK(runtime);
|
||||
for (PyThreadState *tstate = interp->threads.head; tstate != NULL; tstate = tstate->next) {
|
||||
_Py_FOR_EACH_TSTATE_BEGIN(interp, tstate) {
|
||||
_Py_set_eval_breaker_bit(tstate, bit);
|
||||
}
|
||||
HEAD_UNLOCK(runtime);
|
||||
_Py_FOR_EACH_TSTATE_END(interp);
|
||||
}
|
||||
|
||||
void
|
||||
_Py_unset_eval_breaker_bit_all(PyInterpreterState *interp, uintptr_t bit)
|
||||
{
|
||||
_PyRuntimeState *runtime = &_PyRuntime;
|
||||
|
||||
HEAD_LOCK(runtime);
|
||||
for (PyThreadState *tstate = interp->threads.head; tstate != NULL; tstate = tstate->next) {
|
||||
_Py_FOR_EACH_TSTATE_BEGIN(interp, tstate) {
|
||||
_Py_unset_eval_breaker_bit(tstate, bit);
|
||||
}
|
||||
HEAD_UNLOCK(runtime);
|
||||
_Py_FOR_EACH_TSTATE_END(interp);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user