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

Set the thread name before detaching the thread #2762

Merged
merged 1 commit into from Feb 26, 2020

Conversation

mkauf
Copy link
Contributor

@mkauf mkauf commented May 3, 2018

pthread_setname_np() does not work reliably when a thread has been created in a detached state. Set the thread name first, and then call pthread_detach() afterwards (if necessary).

This prevents error messages like this one:

set_thread_name("unixsock conn"): No such process

ChangeLog: Fix a race condition when setting thread names

kwiatrox
kwiatrox previously approved these changes Jul 22, 2019
Copy link
Member

@kwiatrox kwiatrox left a comment

Choose a reason for hiding this comment

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

LGTM. It looks like clang-format is required.

@mkauf
Copy link
Contributor Author

mkauf commented Jul 22, 2019

@kwiatrox I rebased on the current master, now the format is OK. Can you please approve once again, after the tests have run?

kwiatrox
kwiatrox previously approved these changes Jul 23, 2019
@mkauf
Copy link
Contributor Author

mkauf commented Jul 23, 2019

@mrunge You have merged some PRs lately, can you please merge this PR too? It's already approved.

pthread_setname_np() does not work reliably when a thread has been
created in a detached state. Set the thread name first, and then call
pthread_detach() afterwards (if necessary).

This prevents error messages like this one:
set_thread_name("unixsock conn"): No such process
Copy link
Contributor

@dago dago left a comment

Choose a reason for hiding this comment

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

LGTM

@dago dago added this to the 5.11.0 milestone Feb 26, 2020
@dago dago merged commit 4bf2841 into collectd:master Feb 26, 2020
@mkauf mkauf deleted the set_thread_name branch January 30, 2022 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants