dart-sdk/runtime
Martin Kustermann f9eb97fdff Reland "[vm] Expose Dart_{CurrentIsolate,ExitIsolate,EnterIsolate}"
For applications that want to have arbitrary number of isolates call
into native code that may be blocking, we expose the API functions that
allows those native threads to exit an isolate before running
long/blocking code.

Without the ability to exit/re-enter isolate, one may experience
deadlocks as we have a fixed limit on the number of concurrently
executing isolates atm.

In the longer term we may find a way to do this automatically
with low overhead, see [0]. But since those API functions are quite
stable and we already expose e.g. `Dart_{Enter,Exit}Scope`, I don't
see a reason not to expose `Dart_{Enter,Exit}Isolate`.

Difference to original CL:

  Do use STL synchronization primitives (as the ones in runtime/bin
  are not always available in shared libraries)


[0] Issue https://github.com/dart-lang/sdk/issues/51261

Issue https://github.com/dart-lang/sdk/issues/51254

TEST=ffi{,_2}/dl_api_exit_enter_isolate_test

Change-Id: Id817e8d4edb3db35f029248d62388cbd0682001d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294980
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-04-13 09:20:17 +00:00
..
bin Reland "[vm] Expose Dart_{CurrentIsolate,ExitIsolate,EnterIsolate}" 2023-04-13 09:20:17 +00:00
docs [vm] Update to constexpr in runtime/vm. 2023-04-12 22:18:54 +00:00
include Reland "[vm] Expose Dart_{CurrentIsolate,ExitIsolate,EnterIsolate}" 2023-04-13 09:20:17 +00:00
lib [vm] Update to constexpr in runtime/platform and lib. 2023-04-11 17:43:58 +00:00
observatory Make Iterable be the default implementation of itself. 2023-04-04 21:45:19 +00:00
observatory_2 Make Iterable be the default implementation of itself. 2023-04-04 21:45:19 +00:00
platform [vm] Update to constexpr in runtime/platform and lib. 2023-04-11 17:43:58 +00:00
tests [infra] Add missing symbolizer environment variables to isolate stress test runner. 2023-04-07 22:24:51 +00:00
third_party Spelling pkg analyzer lib 2023-01-25 14:08:27 +00:00
tools [vm] Make writeHeapSnapshotToFile() API public in dart:developer 2023-04-03 12:25:55 +00:00
vm [vm] Update to constexpr in runtime/vm. 2023-04-12 22:18:54 +00:00
.clang-tidy
.gitignore
BUILD.gn [ VM ] Add support for samping heap profiler in PRODUCT mode 2023-03-24 14:02:14 +00:00
codereview.settings
configs.gni [vm/ffi] FfiNative process lookup 2022-10-25 10:57:07 +00:00
CPPLINT.cfg [cpplint] Disable runtime/references lint 2023-01-23 18:21:48 +00:00
OWNERS [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
PRESUBMIT.py Revert "[VM] Begin supporting Perfetto file recorder" 2023-02-28 12:41:00 +00:00
runtime_args.gni [ VM ] Add support for samping heap profiler in PRODUCT mode 2023-03-24 14:02:14 +00:00