gh-117657: Quiet more TSAN warnings due to incorrect modeling of compare/exchange (#117830)

This commit is contained in:
mpage 2024-04-15 09:17:55 -07:00 committed by GitHub
parent 6e0b327690
commit 0d5238373d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2003,7 +2003,7 @@ tstate_try_attach(PyThreadState *tstate)
static void
tstate_set_detached(PyThreadState *tstate, int detached_state)
{
assert(tstate->state == _Py_THREAD_ATTACHED);
assert(_Py_atomic_load_int_relaxed(&tstate->state) == _Py_THREAD_ATTACHED);
#ifdef Py_GIL_DISABLED
_Py_atomic_store_int(&tstate->state, detached_state);
#else
@ -2068,7 +2068,7 @@ static void
detach_thread(PyThreadState *tstate, int detached_state)
{
// XXX assert(tstate_is_alive(tstate) && tstate_is_bound(tstate));
assert(tstate->state == _Py_THREAD_ATTACHED);
assert(_Py_atomic_load_int_relaxed(&tstate->state) == _Py_THREAD_ATTACHED);
assert(tstate == current_fast_get());
if (tstate->critical_section != 0) {
_PyCriticalSection_SuspendAll(tstate);