10000 Preserve thread name after attaching it to JVM by Hsilgos · Pull Request #838 · c-ares/c-ares · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Preserve thread name after attaching it to JVM #838

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

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

Hsilgos
Copy link
Contributor
@Hsilgos Hsilgos commented Jul 29, 2024

When native thread is attached to JVM, then it's name is taken from JavaVMAttachArgs. When no JavaVMAttachArgs, or no JavaVMAttachArgs::name passed, then JVM on its own decides on taming thread. Those names are not descriptive. To preserve thread name, pass the currently set thread name in JavaVMAttachArgs::name. pthread_getname_np was introduced in API 26, hence use more generic approach.

Fixes: #837

When native thread is attached to JVM, then it's name is taken from JavaVMAttachArgs.
When no JavaVMAttachArgs, or no JavaVMAttachArgs::name passed,
then JVM on its own decides on taming thread. Those names are not descriptive.
To preserve thread name, pass the currently set thread name in JavaVMAttachArgs::name.
pthread_getname_np was introduced in API 26, hence use more generic approach.

Signed-off-by: Yauheni Khnykin <yauheni.khnykin@here.com>
@bradh352
Copy link
Member

also, not sure if you'd be interested in maybe helping out with creating a github action for building the Android library. Currently our CI system isn't building android to validate PRs like this. :)

@Hsilgos
Copy link
Contributor Author
Hsilgos commented Jul 29, 2024

also, not sure if you'd be interested in maybe helping out with creating a github action for building the Android library. Currently our CI system isn't building android to validate PRs like this. :)

I may have a look at weekend

@Hsilgos Hsilgos requested a review from bradh352 July 30, 2024 15:51
@Hsilgos Hsilgos requested a review from bradh352 July 31, 2024 09:49
@bradh352
Copy link
Member

looks good to me. If you think you can add a GitHub Action to do a test build for android, I'll wait on that and accept it as one PR ...

@bradh352
Copy link
Member
bradh352 commented Aug 1, 2024

I ended up adding a GitHub action, so I'll go ahead and merge this. Thanks!

@bradh352 bradh352 merged commit 9377126 into c-ares:main Aug 1, 2024
33 checks passed
bradh352 pushed a commit that referenced this pull request Aug 2, 2024
When native thread is attached to JVM, then it's name is taken from
JavaVMAttachArgs. When no JavaVMAttachArgs, or no JavaVMAttachArgs::name
passed, then JVM on its own decides on taming thread. Those names are
not descriptive. To preserve thread name, pass the currently set thread
name in JavaVMAttachArgs::name. pthread_getname_np was introduced in API
26, hence use more generic approach.

Fixes #837
Authored By: Yauheni Khnykin (@Hsilgos)
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.

AttachCurrentThread spoils current thread mame
2 participants
0