runEventLoopSync method

  1. @Since.new("3.13")
void runEventLoopSync()

Run event loop for the target isolate synchronously on the current thread.

This function will block until it acquires exclusive access to the target isolate. Isolate can only be entered for synchronous execution between turns of its event loop, when no other thread is executing code in the target isolate.

This function will return once the isolate has no open keep-alive receive ports.

The isolate will be marked as pinned to the current thread.

Similar to Dart_RunLoop Dart VM C API, but unlike Dart_RunLoop this function executes isolate's event loop on the current thread instead of delegating it into the thread-pool.

Throws an error if target isolate is pinned to another thread or already has an event loop running.

Implementation

@Since("3.13")
external void runEventLoopSync();