We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 79066a0 commit eb9bc91Copy full SHA for eb9bc91
Include/object.h
@@ -283,6 +283,13 @@ _Py_ThreadId(void)
283
// Both GCC and Clang have supported __builtin_thread_pointer
284
// for s390 from long time ago.
285
tid = (uintptr_t)__builtin_thread_pointer();
286
+#elif defined(__riscv)
287
+ #if defined(__clang__) && _Py__has_builtin(__builtin_thread_pointer)
288
+ tid = (uintptr_t)__builtin_thread_pointer();
289
+ #else
290
+ // tp is Thread Pointer provided by the RISC-V ABI.
291
+ __asm__ ("mv %0, tp" : "=r" (tid));
292
+ #endif
293
#elif defined(thread_local) || defined(__GNUC__)
294
#if defined(thread_local)
295
static thread_local int __tp = 0;
0 commit comments