-
Notifications
You must be signed in to change notification settings - Fork 52
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
[jnigen] Add doc about threading #1751
Conversation
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. Coverage ✔️
This check for test coverage is informational (issues shown here will not fail the PR). License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
|
@@ -0,0 +1,46 @@ | |||
## Threading considerations | |||
|
|||
Unlike method channels, JNIgen uses FFI calls. This means that the calls happen |
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.
If you expand on this explanation, I think it'll make the section below more clear. My understanding is that jnigen calls the Dart callback directly if they're already on the correct thread, and dispatches a message to the target isolate if not. And in the dispatching case the callback can be configured to wait for a response or not. So your documentation should mention each of those cases.
Also mention that, in any case, the Dart callback is always run in the isolate it was created in (this is something users have been confused about). Maybe also add a note that in upcoming versions of flutter, the main isolate will always run on the platform thread (I couldn't find any docs about that, but you could link to this bug).
Close #611