gh-81925: Implement native thread ids for kFreeBSD (#111761)

---------

Co-authored-by: Antoine Pitrou <antoine@python.org>
This commit is contained in:
Samuel Thibault 2023-11-09 21:02:30 +01:00 committed by GitHub
parent 0c61d028be
commit 0802fd6c8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 5 deletions

View file

@ -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();