-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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
gh-120837: Update _Py_DumpExtensionModules to be async-signal-safe #121051
Conversation
Python/pylifecycle.c
Outdated
PyMutex *mutex = &obj->ob_mutex; | ||
uint8_t expected = _Py_UNLOCKED; | ||
// Do not wake up other threads. | ||
_Py_atomic_compare_exchange_uint8(&mutex->_bits, &expected, _Py_UNLOCKED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to run for loop to prevent CAS failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a _Py_atomic_store_uint8(&mutex->_bits, _Py_UNLOCKED)
@colesbury PTAL :) |
Python/pylifecycle.c
Outdated
PyMutex *mutex = &obj->ob_mutex; | ||
uint8_t expected = _Py_UNLOCKED; | ||
// Do not wake up other threads. | ||
_Py_atomic_compare_exchange_uint8(&mutex->_bits, &expected, _Py_UNLOCKED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a _Py_atomic_store_uint8(&mutex->_bits, _Py_UNLOCKED)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for fixing this!
(I left one minor comment inline. Up to you what you want to do with it.)
Python/pylifecycle.c
Outdated
#else | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The #else return;
doesn't do anything. I would delete it, but up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Thanks @corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…afe (pythongh-121051) (cherry picked from commit 1a2e7a7) Co-authored-by: Donghee Na <[email protected]>
GH-121107 is a backport of this pull request to the 3.13 branch. |
faulthandler
itself crashes in free-threading build (in_Py_DumpExtensionModules
) #120837