5a32d8bc7c
This CL turns native ports into a thin abstraction over underlying thread pool instead of building them as full fledged MessageHandler. This allows to easily implement a variation of native ports which can handle messages concurrently with the given degree of concurrency. This type of port can be used to greatly simplify implementation of IOService - which previously had to do its own concurrency management on top of "single threaded" native ports. This capability is exposed as `Dart_NewConcurrentNativePort` API. The new implementation is in general much cleaner then the old one with one exception: `Dart_CloseNativePort` API has unfortunate design where underlying message handler is destroyed asynchronously and `Dart_CloseNativePort` returns immediately without waiting for pending tasks to complete. Implementing this on top of `ThreadPool` requires some changes to thread pool implementation. Issue https://github.com/dart-lang/sdk/issues/55844 TEST=ci Change-Id: I062040ff233e93962ae93684e9b044d8facdaffc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382163 Commit-Queue: Slava Egorov <vegorov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>