https://github.com/python/cpython/commit/492b224b991cd9027f1bc6d9988d01e94f764992
commit: 492b224b991cd9027f1bc6d9988d01e94f764992
branch: main
author: Furkan Onder <[email protected]>
committer: vstinner <[email protected]>
date: 2024-12-28T19:49:45+01:00
summary:
gh-128279: Enhance the NetBSD compatibility for thread naming (#128280)
Enhance NetBSD compatibility for thread naming in _threadmodule.c.
files:
M Modules/_threadmodule.c
M configure
M configure.ac
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 75b34a8df7622c..2cbdfeb09b95ae 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -2438,6 +2438,9 @@ _thread_set_name_impl(PyObject *module, PyObject
*name_obj)
const char *name = PyBytes_AS_STRING(name_encoded);
#ifdef __APPLE__
int rc = pthread_setname_np(name);
+#elif defined(__NetBSD__)
+ pthread_t thread = pthread_self();
+ int rc = pthread_setname_np(thread, "%s", (void *)name);
#else
pthread_t thread = pthread_self();
int rc = pthread_setname_np(thread, name);
diff --git a/configure b/configure
index a697bc1f87b012..299eff6bc3bf70 100755
--- a/configure
+++ b/configure
@@ -29148,6 +29148,7 @@ CPPFLAGS=$save_CPPFLAGS
case "$ac_sys_system" in
Linux*) PYTHREAD_NAME_MAXLEN=15;; # Linux and Android
SunOS*) PYTHREAD_NAME_MAXLEN=31;;
+ NetBSD*) PYTHREAD_NAME_MAXLEN=31;;
Darwin) PYTHREAD_NAME_MAXLEN=63;;
iOS) PYTHREAD_NAME_MAXLEN=63;;
FreeBSD*) PYTHREAD_NAME_MAXLEN=98;;
diff --git a/configure.ac b/configure.ac
index ebc15503f069cc..badb19d55895de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7514,6 +7514,7 @@ _RESTORE_VAR([CPPFLAGS])
case "$ac_sys_system" in
Linux*) PYTHREAD_NAME_MAXLEN=15;; # Linux and Android
SunOS*) PYTHREAD_NAME_MAXLEN=31;;
+ NetBSD*) PYTHREAD_NAME_MAXLEN=31;;
Darwin) PYTHREAD_NAME_MAXLEN=63;;
iOS) PYTHREAD_NAME_MAXLEN=63;;
FreeBSD*) PYTHREAD_NAME_MAXLEN=98;;
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]