gh-112535: Update _Py_ThreadId() to support s390/s390x (gh-112751)

This commit is contained in:
Donghee Na 2023-12-08 14:28:07 +00:00 committed by GitHub
parent e6ac25429f
commit c744dbe9ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -279,6 +279,10 @@ _Py_ThreadId(void)
__asm__ ("" : "=r" (tp)); __asm__ ("" : "=r" (tp));
tid = tp; tid = tp;
#endif #endif
#elif defined(__s390__) && defined(__GNUC__)
// Both GCC and Clang have supported __builtin_thread_pointer
// for s390 from long time ago.
tid = (uintptr_t)__builtin_thread_pointer();
#else #else
# error "define _Py_ThreadId for this platform" # error "define _Py_ThreadId for this platform"
#endif #endif