Skip to content

gh-59705: Set OS thread name when Thread.name is changed#127702

Merged
vstinner merged 3 commits intopython:mainfrom
vstinner:thread_change_name
Dec 10, 2024
Merged

gh-59705: Set OS thread name when Thread.name is changed#127702
vstinner merged 3 commits intopython:mainfrom
vstinner:thread_change_name

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Dec 6, 2024

@vstinner
Copy link
Member Author

vstinner commented Dec 6, 2024

@serhiy-storchaka @encukou: I propose to update the OS thread name when Thread.name of a running thread is changed, but only if it's the current thread.

The problem is that on macOS, pthread_setname_np() has a single argument: the thread name.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. There are questions for implementation (What about empty name? Is not it dangerous to silently ignore setting the OS name when set name from other thread?), but we can only answer them after users started using this feature.

vstinner and others added 2 commits December 10, 2024 14:13
Co-authored-by: Petr Viktorin <encukou@gmail.com>
@vstinner vstinner merged commit c91ccbe into python:main Dec 10, 2024
@vstinner vstinner deleted the thread_change_name branch December 10, 2024 16:33
@vstinner
Copy link
Member Author

Merged, thanks for reviews.

srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants