bpo-37077: Add native thread ID (TID) for AIX (GH-13624) · python/cpython@886d83e (original) (raw)
5 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -106,7 +106,7 @@ This module defines the following constants and functions: | ||
106 | 106 | Its value may be used to uniquely identify this particular thread system-wide |
107 | 107 | (until the thread terminates, after which the value may be recycled by the OS). |
108 | 108 | |
109 | - .. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD. | |
109 | + .. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX. | |
110 | 110 | |
111 | 111 | .. versionadded:: 3.8 |
112 | 112 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -82,7 +82,7 @@ This module defines the following functions: | ||
82 | 82 | Its value may be used to uniquely identify this particular thread system-wide |
83 | 83 | (until the thread terminates, after which the value may be recycled by the OS). |
84 | 84 | |
85 | - .. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD. | |
85 | + .. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX. | |
86 | 86 | |
87 | 87 | .. versionadded:: 3.8 |
88 | 88 |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -26,7 +26,7 @@ PyAPI_FUNC(unsigned long) PyThread_start_new_thread(void (*)(void *), void *); | ||||||
26 | 26 | PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void); | ||||
27 | 27 | PyAPI_FUNC(unsigned long) PyThread_get_thread_ident(void); | ||||
28 | 28 | |||||
29 | -#if defined(__APPLE__) | | defined(__linux__) | defined(__FreeBSD__) | |||
29 | +#if defined(__APPLE__) | | defined(__linux__) | defined(__FreeBSD__) | |||
30 | 30 | #define PY_HAVE_THREAD_NATIVE_ID | ||||
31 | 31 | PyAPI_FUNC(unsigned long) PyThread_get_thread_native_id(void); | ||||
32 | 32 | #endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1 | +Add :func:`threading.get_native_id` support for AIX. | |
2 | +Patch by M. Felt |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -18,8 +18,10 @@ | ||
18 | 18 | # include <pthread_np.h> /* pthread_getthreadid_np() */ |
19 | 19 | #elif defined(__OpenBSD__) |
20 | 20 | # include <unistd.h> /* getthrid() */ |
21 | -#elif defined(__NetBSD__) /* _lwp_self */ | |
22 | -# include <lwp.h> | |
21 | +#elif defined(_AIX) | |
22 | +# include <sys/thread.h> /* thread_self() */ | |
23 | +#elif defined(__NetBSD__) | |
24 | +# include <lwp.h> /* _lwp_self() */ | |
23 | 25 | #endif |
24 | 26 | |
25 | 27 | /* The POSIX spec requires that use of pthread_attr_setstacksize |
@@ -330,6 +332,9 @@ PyThread_get_thread_native_id(void) | ||
330 | 332 | #elif defined(__OpenBSD__) |
331 | 333 | pid_t native_id; |
332 | 334 | native_id = getthrid(); |
335 | +#elif defined(_AIX) | |
336 | +tid_t native_id; | |
337 | +native_id = thread_self(); | |
333 | 338 | #elif defined(__NetBSD__) |
334 | 339 | lwpid_t native_id; |
335 | 340 | native_id = _lwp_self(); |