use java to handle threads for l2cap#5
Merged
Merged
Conversation
tony-go
requested changes
Jun 3, 2026
|
|
||
| auto jenv = bare_bluetooth_android_jvm().attach_current_thread(); | ||
| auto *server = reinterpret_cast<bare_bluetooth_android_server_t *>(native_ptr); |
There was a problem hiding this comment.
I wonder if we could have a guard here, like:
Suggested change
| auto *server = reinterpret_cast<bare_bluetooth_android_server_t *>(native_ptr); | |
| auto *server = reinterpret_cast<bare_bluetooth_android_server_t *>(native_ptr); | |
| if (server->destroyed) return |
There was a problem hiding this comment.
I am pretty I saw it elsewhere on this codebase.
Contributor
Author
There was a problem hiding this comment.
bare_bluetooth_android_server_t teardown is synchronous and doesn't have async actions that might still be in progress during teardown like bare_bluetooth_android_peripheral_t and bare_bluetooth_android_channel_t do (they use that destroyed property pattern). So I think we don't need it here? I could be wrong though.
This was referenced Jun 8, 2026
Merged
kasperisager
requested changes
Jun 8, 2026
kasperisager
left a comment
Contributor
There was a problem hiding this comment.
There's also some exception APIs to figure out for libjnitl, but we can do that separately. It's becoming increasingly relevant 👀
tony-go
approved these changes
Jun 8, 2026
kasperisager
approved these changes
Jun 9, 2026
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.
This could be an alternative to #2.
The goal: use java to handle threads, only plain data moving across threads, keep java_global_ref_t usage on js threads.
This introduces a few new Java classes, which feels like the right tradeoff given the implementation is clearer than how I left #2.