From: Matthias Klose Date: Sun, 10 Jan 2021 15:42:50 +0000 (+0000) Subject: hurd_kfreebsd_thread_native_id X-Git-Tag: archive/raspbian/3.9.1-2+rpi1^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ce77074b8172d8da85e8c958448020f11d839351;p=python3.9.git hurd_kfreebsd_thread_native_id Gbp-Pq: Name hurd_kfreebsd_thread_native_id.diff --- diff --git a/Include/pythread.h b/Include/pythread.h index bb9d864..a1d6af3 100644 --- a/Include/pythread.h +++ b/Include/pythread.h @@ -25,7 +25,7 @@ PyAPI_FUNC(unsigned long) PyThread_start_new_thread(void (*)(void *), void *); PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void); PyAPI_FUNC(unsigned long) PyThread_get_thread_ident(void); -#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(_WIN32) || defined(_AIX) +#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(_WIN32) || defined(_AIX) || defined(__GNU__) #define PY_HAVE_THREAD_NATIVE_ID PyAPI_FUNC(unsigned long) PyThread_get_thread_native_id(void); #endif diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index e6910b3..d4f9ce9 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -17,12 +17,17 @@ # include /* syscall(SYS_gettid) */ #elif defined(__FreeBSD__) # include /* pthread_getthreadid_np() */ +#elif defined(__FreeBSD_kernel__) +# include /* syscall(SYS_thr_self) */ #elif defined(__OpenBSD__) # include /* getthrid() */ #elif defined(_AIX) # include /* thread_self() */ #elif defined(__NetBSD__) # include /* _lwp_self() */ +#elif defined(__GNU__) +# include /* mach_thread_self(), mach_task_self(), + mach_port_deallocate() */ #endif /* The POSIX spec requires that use of pthread_attr_setstacksize @@ -338,6 +343,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(); @@ -347,6 +355,10 @@ PyThread_get_thread_native_id(void) #elif defined(__NetBSD__) lwpid_t native_id; native_id = _lwp_self(); +#elif defined(__GNU__) + mach_port_t native_id; + native_id = mach_thread_self(); + mach_port_deallocate(mach_task_self(), mach_thread_self()); #endif return (unsigned long) native_id; }