8000 gh-128279: Enhance the NetBSD compatibility for thread naming (#128280) · python/cpython@492b224 · GitHub
[go: up one dir, main page]

Skip to content

Commit 492b224

Browse files
authored
gh-128279: Enhance the NetBSD compatibility for thread naming (#128280)
Enhance NetBSD compatibility for thread naming in _threadmodule.c.
1 parent 2cf396c commit 492b224

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

Modules/_threadmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,6 +2438,9 @@ _thread_set_name_impl(PyObject *module, PyObject *name_obj)
24382438
const char *name = PyBytes_AS_STRING(name_encoded);
24392439
#ifdef __APPLE__
24402440
int rc = pthread_setname_np(name);
2441+
#elif defined(__NetBSD__)
2442+
pthread_t thread = pthread_self();
2443+
int rc = pthread_setname_np(thread, "%s", (void *)name);
24412444
#else
24422445
pthread_t thread = pthread_self();
24432446
int rc = pthread_setname_np(thread, name);

configure

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7514,6 +7514,7 @@ _RESTORE_VAR([CPPFLAGS])
75147514
case "$ac_sys_system" in
75157515
Linux*) PYTHREAD_NAME_MAXLEN=15;; # Linux and Android
75167516
SunOS*) PYTHREAD_NAME_MAXLEN=31;;
7517+
NetBSD*) PYTHREAD_NAME_MAXLEN=31;;
75177518
Darwin) PYTHREAD_NAME_MAXLEN=63;;
75187519
iOS) PYTHREAD_NAME_MAXLEN=63;;
75197520
FreeBSD*) PYTHREAD_NAME_MAXLEN=98;;

0 commit comments

Comments
 (0)
0