8000 bpo-42047: Add native thread ID for DragonFlyBSD (#22714) · varunsh-coder/cpython@9a1adf2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a1adf2

Browse files
devnexenblurb-it[bot]Fidget-Spinnererlend-aaslandvstinner
authored
bpo-42047: Add native thread ID for DragonFlyBSD (python#22714)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: kj <28750310+Fidget-Spinner@users.noreply.github.com> Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent e0477ae commit 9a1adf2

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

Doc/library/_thread.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ This module defines the following constants and functions:
118118
Its value may be used to uniquely identify this particular thread system-wide
119119
(until the thread terminates, after which the value may be recycled by the OS).
120120

121-
.. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX.
121+
.. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX, DragonFlyBSD.
122122

123123
.. versionadded:: 3.8
124124

Doc/library/threading.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ This module defines the following functions:
114114
Its value may be used to uniquely identify this particular thread system-wide
115115
(until the thread terminates, after which the value may be recycled by the OS).
116116

117-
.. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX.
117+
.. availability:: Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX, DragonFlyBSD.
118118

119119
.. versionadded:: 3.8
120120

Include/pythread.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ PyAPI_FUNC(unsigned long) PyThread_start_new_thread(void (*)(void *), void *);
2020
PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void);
2121
PyAPI_FUNC(unsigned long) PyThread_get_thread_ident(void);
2222

23-
#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(_WIN32) || defined(_AIX)
23+
#if (defined(__APPLE__) || defined(__linux__) || defined(_WIN32) \
24+
|| defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
25+
|| defined(__DragonFly__) || defined(_AIX))
2426
#define PY_HAVE_THREAD_NATIVE_ID
2527
PyAPI_FUNC(unsigned long) PyThread_get_thread_native_id(void);
2628
#endif
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add :func:`threading.get_native_id` support for DragonFly BSD. Patch by David Carlier.

Python/thread_pthread.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
# include <sys/thread.h> /* thread_self() */
2424
#elif defined(__NetBSD__)
2525
# include <lwp.h> /* _lwp_self() */
26+
#elif defined(__DragonFly__)
27+
# include <sys/lwp.h> /* lwp_gettid() */
2628
#endif
2729

2830
/* The POSIX spec requires that use of pthread_attr_setstacksize
@@ -349,6 +351,9 @@ PyThread_get_thread_native_id(void)
349351
#elif defined(__NetBSD__)
350352
lwpid_t native_id;
351353
native_id = _lwp_self();
354+
#elif defined(__DragonFly__)
355+
lwpid_t native_id;
356+
native_id = lwp_gettid();
352357
#endif
353358
return (unsigned long) native_id;
354359
}

0 commit comments

Comments
 (0)
0