mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
[3.13] gh-117657: Fix TSAN race in QSBR assertion (GH-119887) (#119904)
Due to a limitation in TSAN, all reads from `PyThreadState.state` must be
atomic to avoid reported races.
(cherry picked from commit 90ec19fd33
)
Co-authored-by: Sam Gross <colesbury@gmail.com>
This commit is contained in:
parent
48f3378d6c
commit
48054d2306
2 changed files with 2 additions and 3 deletions
|
@ -160,7 +160,8 @@ qsbr_poll_scan(struct _qsbr_shared *shared)
|
|||
bool
|
||||
_Py_qsbr_poll(struct _qsbr_thread_state *qsbr, uint64_t goal)
|
||||
{
|
||||
assert(_PyThreadState_GET()->state == _Py_THREAD_ATTACHED);
|
||||
assert(_Py_atomic_load_int_relaxed(&_PyThreadState_GET()->state) == _Py_THREAD_ATTACHED);
|
||||
|
||||
if (_Py_qbsr_goal_reached(qsbr, goal)) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue