summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
authormpage <mpage@meta.com>2024-04-15 16:17:33 (GMT)
committerGitHub <noreply@github.com>2024-04-15 16:17:33 (GMT)
commit6e0b327690c7dd2e4e9091f81f8ad43ad5eb1631 (patch)
tree079703f4ade9ef4a4b11978b3f1fd4081bdf30c6 /Python/pystate.c
parent47832067da54385c6cd5ad0f4f9d7f7dc69ebdb2 (diff)
downloadcpython-6e0b327690c7dd2e4e9091f81f8ad43ad5eb1631.zip
cpython-6e0b327690c7dd2e4e9091f81f8ad43ad5eb1631.tar.gz
cpython-6e0b327690c7dd2e4e9091f81f8ad43ad5eb1631.tar.bz2
gh-117657: Quiet TSAN warning about a data race between `start_the_world()` and `tstate_try_attach()` (#117828)
TSAN erroneously reports a data race between the `_Py_atomic_compare_exchange_int` on `tstate->state` in `tstate_try_attach()` and the non-atomic load of `tstate->state` in `start_the_world`. The `_Py_atomic_compare_exchange_int` fails, but TSAN erroneously treats it as a store.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index acec905..5045402 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -2248,7 +2248,8 @@ start_the_world(struct _stoptheworld_state *stw)
PyThreadState *t;
_Py_FOR_EACH_THREAD(stw, i, t) {
if (t != stw->requester) {
- assert(t->state == _Py_THREAD_SUSPENDED);
+ assert(_Py_atomic_load_int_relaxed(&t->state) ==
+ _Py_THREAD_SUSPENDED);
_Py_atomic_store_int(&t->state, _Py_THREAD_DETACHED);
_PyParkingLot_UnparkAll(&t->state);
}