summaryrefslogtreecommitdiffstats
path: root/Include/cpython
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-09-27 19:41:06 (GMT)
committerGitHub <noreply@github.com>2023-09-27 19:41:06 (GMT)
commit32466c97c06ee5812923d695195394c736eeb707 (patch)
treee5de52c5dcc30067c6cd79fa97b66d104f911ea4 /Include/cpython
parentf49958c886a2f2608f1008186d588efc2a98b445 (diff)
downloadcpython-32466c97c06ee5812923d695195394c736eeb707.zip
cpython-32466c97c06ee5812923d695195394c736eeb707.tar.gz
cpython-32466c97c06ee5812923d695195394c736eeb707.tar.bz2
gh-109793: Allow Switching Interpreters During Finalization (gh-109794)
Essentially, we should check the thread ID rather than the thread state pointer.
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/pyatomic.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/Include/cpython/pyatomic.h b/Include/cpython/pyatomic.h
index ab18238..ce23e13 100644
--- a/Include/cpython/pyatomic.h
+++ b/Include/cpython/pyatomic.h
@@ -501,3 +501,20 @@ static inline void _Py_atomic_fence_release(void);
#else
# error "no available pyatomic implementation for this platform/compiler"
#endif
+
+
+// --- aliases ---------------------------------------------------------------
+
+#if SIZEOF_LONG == 8
+# define _Py_atomic_load_ulong _Py_atomic_load_uint64
+# define _Py_atomic_load_ulong_relaxed _Py_atomic_load_uint64_relaxed
+# define _Py_atomic_store_ulong _Py_atomic_store_uint64
+# define _Py_atomic_store_ulong_relaxed _Py_atomic_store_uint64_relaxed
+#elif SIZEOF_LONG == 4
+# define _Py_atomic_load_ulong _Py_atomic_load_uint32
+# define _Py_atomic_load_ulong_relaxed _Py_atomic_load_uint32_relaxed
+# define _Py_atomic_store_ulong _Py_atomic_store_uint32
+# define _Py_atomic_store_ulong_relaxed _Py_atomic_store_uint32_relaxed
+#else
+# error "long must be 4 or 8 bytes in size"
+#endif // SIZEOF_LONG