mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +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
|
@ -119,7 +119,7 @@ get_reftotal(PyInterpreterState *interp)
|
|||
since we can't determine which interpreter updated it. */
|
||||
Py_ssize_t total = REFTOTAL(interp);
|
||||
#ifdef Py_GIL_DISABLED
|
||||
for (PyThreadState *p = interp->threads.head; p != NULL; p = p->next) {
|
||||
_Py_FOR_EACH_TSTATE_UNLOCKED(interp, p) {
|
||||
/* This may race with other threads modifications to their reftotal */
|
||||
_PyThreadStateImpl *tstate_impl = (_PyThreadStateImpl *)p;
|
||||
total += _Py_atomic_load_ssize_relaxed(&tstate_impl->reftotal);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue