-
Notifications
You must be signed in to change notification settings - Fork 56
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
[jni] Add a call to jvm.DetachCurrentThread when the thread detaches #1163
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
16a2c55
Add a call to jvm.DetachCurrentThread when the thread detaches
HosseinYousefi 5e51399
Fix windows implementation
HosseinYousefi 70bd232
Add changelog
HosseinYousefi 97c26a8
Fix windows again
HosseinYousefi de72f97
Merge branch 'detach-current-thread' of https://github.com/dart-lang/…
HosseinYousefi 33e7ab9
Fix windows yet another time!
HosseinYousefi 9fa7a46
Extern tlsKeys
HosseinYousefi b9f160d
Do TlsAlloc/TlsFree in DllMain
HosseinYousefi fa07126
Unify the ifdef styles
HosseinYousefi cfe3be5
Using TlsAlloc is not needed in Windows. Assume anything not _Win32 t…
HosseinYousefi 35f59e9
Oops, fix build
HosseinYousefi cccad1f
Pass the reference (`&jniEnv`) to `pthread_setspecific`
HosseinYousefi 8061d8b
Address comments
HosseinYousefi 4f04ef0
Run clang-format
HosseinYousefi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sidenote: This
DllMain
is assuming the C code inpackage:jni
gets compiled into it's own DLL (?). That would prevent statically linking it into a bigger library (which may have already a differentDllMain
). It's a little bit of a smell I think.If we can use C++ here (if not: why?) then a global C++ object can do things in it's constructor and destructor (e.g. initializer locks and free them, create TLS keys, free them, ...) that get run on shared library load & unload times.
(Arguably this doesn't solve the issue of detaching the thread from java at exit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use C++. We would have to wrap the functions we want to call from Dart in
extern "C"
but otherwise it should not be a problem. We also generate another C file fromjni.h
which wraps the API and does things like conversion to global refs and exception checking.In general, I did not really refactor the C code we had since 2 years ago. I think it's worth it to open an issue and do this in the near future. #1169