]> granicus.if.org Git - python/commitdiff
bpo-37077: Add native thread ID (TID) for AIX (GH-13624)
authorMichael Felt <aixtools@users.noreply.github.com>
Thu, 13 Jun 2019 22:34:46 +0000 (00:34 +0200)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 13 Jun 2019 22:34:46 +0000 (15:34 -0700)
This is the followup  for issue36084

https://bugs.python.org/issue37077

Doc/library/_thread.rst
Doc/library/threading.rst
Include/pythread.h
Misc/NEWS.d/next/Core and Builtins/2019-05-28-11-47-44.bpo-37077.S1h0Fc.rst [new file with mode: 0644]
Python/thread_pthread.h

index 5b4fcde669e13b9d773dfedbb6740ef5cfe1cae1..bd653ab32bb9c43425ba0107f495110ae07286de 100644 (file)
@@ -106,7 +106,7 @@ This module defines the following constants and functions:
    Its value may be used to uniquely identify this particular thread system-wide
    (until the thread terminates, after which the value may be recycled by the OS).
 
-   .. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD.
+   .. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX.
 
    .. versionadded:: 3.8
 
index b4f4814c4ad37bcd5e22239a8211d215d9575c38..2907b65f5bca42ffc7fcf2004a0472173522dc9d 100644 (file)
@@ -82,7 +82,7 @@ This module defines the following functions:
    Its value may be used to uniquely identify this particular thread system-wide
    (until the thread terminates, after which the value may be recycled by the OS).
 
-   .. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD.
+   .. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX.
 
    .. versionadded:: 3.8
 
index 79a9210af3a491a75b4ebda5f20a2aca6888a541..f22e8c42c502777969e6516c9257341b2b50e4d7 100644 (file)
@@ -26,7 +26,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)
+#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(_WIN32) || defined(_AIX)
 #define PY_HAVE_THREAD_NATIVE_ID
 PyAPI_FUNC(unsigned long) PyThread_get_thread_native_id(void);
 #endif
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-05-28-11-47-44.bpo-37077.S1h0Fc.rst b/Misc/NEWS.d/next/Core and Builtins/2019-05-28-11-47-44.bpo-37077.S1h0Fc.rst
new file mode 100644 (file)
index 0000000..832dfc9
--- /dev/null
@@ -0,0 +1,2 @@
+Add :func:`threading.get_native_id` support for AIX.
+Patch by M. Felt
index 9b4b23bdc7d7bf2a6e6c2d90d2edb09028d3557d..a36d16c19eade5e07d2678077bfdb914905e0809 100644 (file)
 #   include <pthread_np.h>      /* pthread_getthreadid_np() */
 #elif defined(__OpenBSD__)
 #   include <unistd.h>          /* getthrid() */
-#elif defined(__NetBSD__)       /* _lwp_self */
-#   include <lwp.h>
+#elif defined(_AIX)
+#   include <sys/thread.h>      /* thread_self() */
+#elif defined(__NetBSD__)
+#   include <lwp.h>             /* _lwp_self() */
 #endif
 
 /* The POSIX spec requires that use of pthread_attr_setstacksize
@@ -330,6 +332,9 @@ PyThread_get_thread_native_id(void)
 #elif defined(__OpenBSD__)
     pid_t native_id;
     native_id = getthrid();
+#elif defined(_AIX)
+    tid_t native_id;
+    native_id = thread_self();
 #elif defined(__NetBSD__)
     lwpid_t native_id;
     native_id = _lwp_self();