From fd3c74ddd6b56a77f5734dd1f319cba47f5bc031 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Thu, 15 Oct 2020 20:31:26 +0100 Subject: [PATCH 1/7] DragonFlyBSD thread native id support. --- Include/pythread.h | 2 +- Python/thread_pthread.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Include/pythread.h b/Include/pythread.h index bb9d86412218ad..771f99ca1dba2f 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(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(_WIN32) || defined(_AIX) #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 e6910b3083a892..fc1424186007eb 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -23,6 +23,8 @@ # include /* thread_self() */ #elif defined(__NetBSD__) # include /* _lwp_self() */ +#elif defined(__DragonFly__) +# include /* lwp_gettid() */ #endif /* The POSIX spec requires that use of pthread_attr_setstacksize @@ -347,6 +349,9 @@ PyThread_get_thread_native_id(void) #elif defined(__NetBSD__) lwpid_t native_id; native_id = _lwp_self(); +#elif defined(__DragonFly__) + lwpid_t native_id; + native_id = lwp_gettid(); #endif return (unsigned long) native_id; } From 1be648a07408a792fc9a0b3798f5b59df297d516 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Thu, 15 Oct 2020 18:37:15 +0000 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst diff --git a/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst b/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst new file mode 100644 index 00000000000000..5c45d1f5d78272 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst @@ -0,0 +1 @@ +Adding thread native id to DragonflyBSD. \ No newline at end of file From ba9f74a21fad3010ac45c59079742dde6ce1d4e3 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Fri, 16 Oct 2020 05:48:10 +0100 Subject: [PATCH 3/7] Update Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst Co-authored-by: kj <28750310+Fidget-Spinner@users.noreply.github.com> --- .../next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst b/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst index 5c45d1f5d78272..360301b63e5011 100644 --- a/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst +++ b/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst @@ -1 +1 @@ -Adding thread native id to DragonflyBSD. \ No newline at end of file +Added thread native id support for DragonflyBSD. From 5a54ad242fee3a3833c8478e51c2232328f6230a Mon Sep 17 00:00:00 2001 From: Erlend Egeberg Aasland Date: Wed, 18 May 2022 12:59:25 +0200 Subject: [PATCH 4/7] Break long line Co-authored-by: Victor Stinner --- Include/pythread.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Include/pythread.h b/Include/pythread.h index 979512dc20984a..63714437c496b7 100644 --- a/Include/pythread.h +++ b/Include/pythread.h @@ -20,7 +20,9 @@ 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(__DragonFly__) || defined(_WIN32) || defined(_AIX) +#if (defined(__APPLE__) || defined(__linux__) || defined(_WIN32) \ + || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \ + || defined(__DragonFly__) || defined(_AIX)) #define PY_HAVE_THREAD_NATIVE_ID PyAPI_FUNC(unsigned long) PyThread_get_thread_native_id(void); #endif From e42ce9af6901e7900b3838b487fc0c97b4efb14a Mon Sep 17 00:00:00 2001 From: Erlend Egeberg Aasland Date: Wed, 18 May 2022 13:23:01 +0200 Subject: [PATCH 5/7] Update Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst --- .../next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst b/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst index 360301b63e5011..66471ca3ad45de 100644 --- a/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst +++ b/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst @@ -1 +1 @@ -Added thread native id support for DragonflyBSD. +Add :func:`threading.get_native_id` support for DragonFly BSD. From 4f26c0e621469cd45a24ea99cedd59334a90e1d9 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Wed, 18 May 2022 12:28:55 +0100 Subject: [PATCH 6/7] Update NEWS entry. --- .../next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst b/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst index 66471ca3ad45de..4c23763cf8d89b 100644 --- a/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst +++ b/Misc/NEWS.d/next/Library/2020-10-15-18-37-12.bpo-42047.XDdoSF.rst @@ -1 +1 @@ -Add :func:`threading.get_native_id` support for DragonFly BSD. +Add :func:`threading.get_native_id` support for DragonFly BSD. Patch by David Carlier. From 88bc0037569628af379b664f21b35289bff86f9b Mon Sep 17 00:00:00 2001 From: David Carlier Date: Wed, 18 May 2022 12:46:41 +0100 Subject: [PATCH 7/7] doc update --- Doc/library/_thread.rst | 2 +- Doc/library/threading.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/_thread.rst b/Doc/library/_thread.rst index 1e6452b7b826fd..75b3834b9a339c 100644 --- a/Doc/library/_thread.rst +++ b/Doc/library/_thread.rst @@ -118,7 +118,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, AIX. + .. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX, DragonFlyBSD. .. versionadded:: 3.8 diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index b7775609616908..0bc1f9d12a86e6 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -114,7 +114,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, AIX. + .. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX, DragonFlyBSD. .. versionadded:: 3.8