summaryrefslogtreecommitdiffstats
path: root/Python/thread_pthread.h
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-11-09 20:02:30 (GMT)
committerGitHub <noreply@github.com>2023-11-09 20:02:30 (GMT)
commit0802fd6c8ee0cacb3ab555dd86e235a5dfab7618 (patch)
treead3f9df8c4fe7cfc83246b7d3040d2876d0553a5 /Python/thread_pthread.h
parent0c61d028be93c52726972d8d96393cc0cedb1086 (diff)
downloadcpython-0802fd6c8ee0cacb3ab555dd86e235a5dfab7618.zip
cpython-0802fd6c8ee0cacb3ab555dd86e235a5dfab7618.tar.gz
cpython-0802fd6c8ee0cacb3ab555dd86e235a5dfab7618.tar.bz2
gh-81925: Implement native thread ids for kFreeBSD (#111761)
--------- Co-authored-by: Antoine Pitrou <antoine@python.org>
Diffstat (limited to 'Python/thread_pthread.h')
-rw-r--r--Python/thread_pthread.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index a8df544..fb3b79f 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -20,6 +20,8 @@
# include <sys/syscall.h> /* syscall(SYS_gettid) */
#elif defined(__FreeBSD__)
# include <pthread_np.h> /* pthread_getthreadid_np() */
+#elif defined(__FreeBSD_kernel__)
+# include <sys/syscall.h> /* syscall(SYS_thr_self) */
#elif defined(__OpenBSD__)
# include <unistd.h> /* getthrid() */
#elif defined(_AIX)
@@ -384,6 +386,9 @@ PyThread_get_thread_native_id(void)
#elif defined(__FreeBSD__)
int native_id;
native_id = pthread_getthreadid_np();
+#elif defined(__FreeBSD_kernel__)
+ long native_id;
+ syscall(SYS_thr_self, &native_id);
#elif defined(__OpenBSD__)
pid_t native_id;
native_id = getthrid();