Skip to content

Conversation

@corona10
Copy link
Member

@corona10corona10 commented Jun 26, 2024

PyMutex*mutex=&obj->ob_mutex;
uint8_texpected=_Py_UNLOCKED;
// Do not wake up other threads.
_Py_atomic_compare_exchange_uint8(&mutex->_bits, &expected, _Py_UNLOCKED);
Copy link
MemberAuthor

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?

Copy link
Contributor

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)

@corona10corona10 requested a review from vstinnerJune 27, 2024 11:10
@corona10corona10 requested a review from vstinnerJune 27, 2024 11:33
@corona10
Copy link
MemberAuthor

@colesbury PTAL :)

PyMutex*mutex=&obj->ob_mutex;
uint8_texpected=_Py_UNLOCKED;
// Do not wake up other threads.
_Py_atomic_compare_exchange_uint8(&mutex->_bits, &expected, _Py_UNLOCKED);
Copy link
Contributor

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)

@corona10corona10 requested a review from colesburyJune 27, 2024 20:53
Copy link
Contributor

@colesburycolesbury left a 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.)

Comment on lines 2922 to 2923
#else
return;
Copy link
Contributor

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.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@corona10corona10 merged commit 1a2e7a7 into python:mainJun 27, 2024
@miss-islington-app
Copy link

Thanks @corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 27, 2024
…afe (pythongh-121051) (cherry picked from commit 1a2e7a7) Co-authored-by: Donghee Na <donghee.na@python.org>
@bedevere-app
Copy link

GH-121107 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13 bugs and security fixes label Jun 27, 2024
@corona10corona10 deleted the gh-120837 branch June 27, 2024 21:47
corona10 added a commit that referenced this pull request Jun 27, 2024
…safe (gh-121051) (gh-121107) gh-120837: Update _Py_DumpExtensionModules to be async-signal-safe (gh-121051) (cherry picked from commit 1a2e7a7) Co-authored-by: Donghee Na <donghee.na@python.org>
mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
Sign up for freeto 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.

3 participants

@corona10@vstinner@colesbury