Skip to content

Commit

Permalink
gh-128279: Enhance the NetBSD compatibility for thread naming (#128280)
Browse files Browse the repository at this point in the history
Enhance NetBSD compatibility for thread naming in _threadmodule.c.
  • Loading branch information
furkanonder authored Dec 28, 2024
1 parent 2cf396c commit 492b224
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Modules/_threadmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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;;
Expand Down

0 comments on commit 492b224

Please sign in to comment.