Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0802fd6

Browse files
sthibaulpitrou
andauthored
gh-81925: Implement native thread ids for kFreeBSD (#111761)
---------Co-authored-by: Antoine Pitrou <antoine@python.org>
1 parent0c61d02 commit0802fd6

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

‎Doc/library/_thread.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,13 @@ This module defines the following constants and functions:
120120
Its value may be used to uniquely identify this particular thread system-wide
121121
(until the thread terminates, after which the value may be recycled by the OS).
122122

123-
..availability::Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX, DragonFlyBSD.
123+
..availability::Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD.
124124

125125
..versionadded::3.8
126126

127+
..versionchanged::3.13
128+
Added support for GNU/kFreeBSD.
129+
127130

128131
..function::stack_size([size])
129132

‎Doc/library/threading.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,13 @@ This module defines the following functions:
127127
Its value may be used to uniquely identify this particular thread system-wide
128128
(until the thread terminates, after which the value may be recycled by the OS).
129129

130-
..availability::Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX, DragonFlyBSD.
130+
..availability::Windows, FreeBSD, Linux, macOS, OpenBSD, NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD.
131131

132132
..versionadded::3.8
133133

134+
..versionchanged::3.13
135+
Added support for GNU/kFreeBSD.
136+
134137

135138
..function::enumerate()
136139

‎Doc/tools/extensions/pyspecific.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ class Availability(SphinxDirective):
127127
# known platform, libc, and threading implementations
128128
known_platforms=frozenset({
129129
"AIX","Android","BSD","DragonFlyBSD","Emscripten","FreeBSD",
130-
"Linux","NetBSD","OpenBSD","POSIX","Solaris","Unix","VxWorks",
131-
"WASI","Windows","macOS",
130+
"GNU/kFreeBSD","Linux","NetBSD","OpenBSD","POSIX","Solaris",
131+
"Unix","VxWorks","WASI","Windows","macOS",
132132
# libc
133133
"BSD libc","glibc","musl",
134134
# POSIX platforms with pthreads

‎Include/pythread.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ PyAPI_FUNC(void) _Py_NO_RETURN PyThread_exit_thread(void);
2121
PyAPI_FUNC(unsigned long)PyThread_get_thread_ident(void);
2222

2323
#if (defined(__APPLE__)|| defined(__linux__)|| defined(_WIN32) \
24-
|| defined(__FreeBSD__)|| defined(__OpenBSD__)|| defined(__NetBSD__) \
24+
|| defined(__FreeBSD__)|| defined(__FreeBSD_kernel__) \
25+
|| defined(__OpenBSD__)|| defined(__NetBSD__) \
2526
|| defined(__DragonFly__)|| defined(_AIX))
2627
#definePY_HAVE_THREAD_NATIVE_ID
2728
PyAPI_FUNC(unsigned long)PyThread_get_thread_native_id(void);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Implement native thread ids for GNU KFreeBSD.

‎Python/thread_pthread.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
# include<sys/syscall.h>/* syscall(SYS_gettid) */
2121
#elif defined(__FreeBSD__)
2222
# include<pthread_np.h>/* pthread_getthreadid_np() */
23+
#elif defined(__FreeBSD_kernel__)
24+
# include<sys/syscall.h>/* syscall(SYS_thr_self) */
2325
#elif defined(__OpenBSD__)
2426
# include<unistd.h>/* getthrid() */
2527
#elif defined(_AIX)
@@ -384,6 +386,9 @@ PyThread_get_thread_native_id(void)
384386
#elif defined(__FreeBSD__)
385387
intnative_id;
386388
native_id=pthread_getthreadid_np();
389+
#elif defined(__FreeBSD_kernel__)
390+
longnative_id;
391+
syscall(SYS_thr_self,&native_id);
387392
#elif defined(__OpenBSD__)
388393
pid_tnative_id;
389394
native_id=getthrid();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp