Skip to content

gh-114940: Add _Py_FOR_EACH_TSTATE_UNLOCKED(), and Friends #127077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ericsnowcurrently
Copy link
Member

@ericsnowcurrently ericsnowcurrently commented Nov 20, 2024

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.

@ericsnowcurrently
Copy link
Member Author

@colesbury, do you have any objections to how I turn _Py_FOR_EACH_THREAD() into _Py_FOR_EACH_STW_INTERP() in pystate.c? Again, it's a fairly mechanical change, but it will allow us to more easily switch to the per-interpreter lock in a follow-up PR.

@colesbury
Copy link
Contributor

No objections from me!

@ericsnowcurrently ericsnowcurrently merged commit 9dabace into python:main Nov 21, 2024
37 checks passed
@ericsnowcurrently ericsnowcurrently deleted the fix-tstates-iteration branch November 21, 2024 18:08
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
…hongh-127077)

This is a precursor to the actual fix for pythongh-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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants