| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Call pthread_setname_np() et al. with the name argument passed to threading.Thread().
|
Unfortunately, the string passed to pthread_setname_np() must be less than 16 chars on Linux, so the name may be truncated. |
Sorry, something went wrong.
|
Will this ever happen?! The Issue has this year the 10th anniversary. In the Issue @eryksun also provides Code for Windows... so let this happen. |
Sorry, something went wrong.
| if _HAVE_THREAD_NATIVE_ID: | ||
| self._set_native_id() | ||
| if _HAVE_SET_THREAD_NAME: | ||
| _set_thread_name(self.name) |
There was a problem hiding this comment.
This should probably be more sophisticated, e.g. f"{sys.executable} [thread {self.name!r}]"
Sorry, something went wrong.
There was a problem hiding this comment.
That wouldn't work well for platforms with the 16-character limitation.
Sorry, something went wrong.
|
I would expect to see some changes to the Docs, how use, and if any affect on whats out there running now. Probably need to add version changed. |
Sorry, something went wrong.
There was a problem hiding this comment.
This needs tests, which in turn will need a getter function -- at least a private one.
Sorry, something went wrong.
| int ret = 0; | ||
| #ifdef __APPLE__ | ||
| // On macOS, pthread_setname_np() can only set the calling thread's name. | ||
| ret = pthread_setname_np(buf); |
There was a problem hiding this comment.
It seems (from the man page) that macOS doesn't have the 16-character limitation. Could we pass the original buffer here?
Sorry, something went wrong.
| if _HAVE_THREAD_NATIVE_ID: | ||
| self._set_native_id() | ||
| if _HAVE_SET_THREAD_NAME: | ||
| _set_thread_name(self.name) |
There was a problem hiding this comment.
That wouldn't work well for platforms with the 16-character limitation.
Sorry, something went wrong.
|
New attempt to implement this feature: #127338 |
Sorry, something went wrong.
|
#127338 was merged instead. Thanks for your contribution anyway! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Call pthread_setname_np() et al. with the name argument passed to
threading.Thread().
https://bugs.python.org/issue15500