Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Dec 10, 2024

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.

Doc/library/threading.rst Outdated Show resolved Hide resolved
@vstinner vstinner merged commit c91ccbe into python:main Dec 10, 2024
41 checks passed
@vstinner vstinner deleted the thread_change_name branch December 10, 2024 16:33
@vstinner
Copy link
Member Author

Merged, thanks for reviews.

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