mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-117657: Fix race data race in _Py_IsOwnedByCurrentThread()
(#118258)
This commit is contained in:
parent
5a4d3df2fa
commit
a5eeb832c2
2 changed files with 4 additions and 1 deletions
|
@ -303,7 +303,11 @@ _Py_ThreadId(void)
|
|||
static inline Py_ALWAYS_INLINE int
|
||||
_Py_IsOwnedByCurrentThread(PyObject *ob)
|
||||
{
|
||||
#ifdef _Py_THREAD_SANITIZER
|
||||
return _Py_atomic_load_uintptr_relaxed(&ob->ob_tid) == _Py_ThreadId();
|
||||
#else
|
||||
return ob->ob_tid == _Py_ThreadId();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue