mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 12:30:03 +00:00
bf4280ff75
Dart_CreateLightweightIsolate API: This API can be used by embedders to create a lightweight isolate (inside an existing isolate group). It is the analogous to Dart_CreateIsolateGroup - though taking a parent isolate as parameter (inside whose IG we create a new isolate) instead of taking kernel/snapshot data. Right now this API works on AOT and returns an error in JIT, both cases are covered by the test. Dart_RunLoopAsync: The API can be used by embedders to transfer ownership of an isolate to the VM, which will take care of running the message handling loop and shuts the isolate down once the last receive port has been closed. It does allow listening to error/exit events generated by the message loop implementation as well as allows setting errors-are-fatal, effectively the same event-loop related parameters from the `Isolate.spawn()` API, just in Dart. It's the embedders responsibility to first launch initial dart code which will take care of responding to events (i.e. directly/indirectly open a receive port) - otherwise the isolate cannot be talked to and would immediately shut down. Since our vm/cc tests do support running in AOT, we use a hybrid approach to test the functionality: We let a normal Dart test call a small C wrapper using FFI, to create a lightweight isolate, run it on a new thread and join that thread. TEST=vm/dart{,_2}/isolates/dart_api_create_lightweight_isolate_test Issue https://github.com/dart-lang/sdk/issues/36097 Closes https://github.com/dart-lang/sdk/issues/44088 Change-Id: Id77ba928793fdb517f6cb7e8130df98a0366ddd6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170983 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> Reviewed-by: Alexander Aprelev <aam@google.com> |
||
---|---|---|
.. | ||
bin | ||
internal | ||
dart_api.h | ||
dart_api_dl.c | ||
dart_api_dl.h | ||
dart_embedder_api.h | ||
dart_native_api.h | ||
dart_tools_api.h | ||
dart_version.h |