mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-117657: Quiet TSAN warnings about remaining non-atomic accesses of tstate->state
(#118165)
Quiet TSAN warnings about remaining non-atomic accesses of `tstate->state`
This commit is contained in:
parent
0d221e9a19
commit
2e7771a03d
2 changed files with 3 additions and 2 deletions
|
@ -194,7 +194,8 @@ _PySemaphore_Wait(_PySemaphore *sema, PyTime_t timeout, int detach)
|
|||
PyThreadState *tstate = NULL;
|
||||
if (detach) {
|
||||
tstate = _PyThreadState_GET();
|
||||
if (tstate && tstate->state == _Py_THREAD_ATTACHED) {
|
||||
if (tstate && _Py_atomic_load_int_relaxed(&tstate->state) ==
|
||||
_Py_THREAD_ATTACHED) {
|
||||
// Only detach if we are attached
|
||||
PyEval_ReleaseThread(tstate);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue