Preserve thread name after attaching it to JVM#838
Merged
bradh352 merged 3 commits intoc-ares:mainfrom Aug 1, 2024
Merged
Conversation
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
requested changes
Jul 29, 2024
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. :) |
Contributor
Author
I may have a look at weekend |
bradh352
reviewed
Jul 30, 2024
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
approved these changes
Jul 31, 2024
Member
|
I ended up adding a GitHub action, so I'll go ahead and merge this. Thanks! |
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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