[io] Limit the IOService to 1 thread when running with --deterministic.
TEST=locally build the SDK twice without RBE Bug: https://github.com/dart-lang/sdk/issues/56884 Change-Id: I59110f92c737fb1137e12114f6bcaacfd6283347 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391463 Reviewed-by: Brian Quinlan <bquinlan@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
committed by
Commit Queue
parent
9a67968189
commit
37b7db0653
@@ -54,9 +54,11 @@ void IOServiceCallback(Dart_Port dest_port_id, Dart_CObject* message) {
|
||||
Dart_PostCObject(reply_port_id, result.AsApiCObject());
|
||||
}
|
||||
|
||||
intptr_t IOService::max_concurrency_ = 32;
|
||||
|
||||
Dart_Port IOService::GetServicePort() {
|
||||
return Dart_NewConcurrentNativePort("IOService", IOServiceCallback,
|
||||
/*max_concurrency=*/32);
|
||||
max_concurrency_);
|
||||
}
|
||||
|
||||
void FUNCTION_NAME(IOService_NewServicePort)(Dart_NativeArguments args) {
|
||||
|
||||
@@ -70,7 +70,12 @@ class IOService {
|
||||
|
||||
static Dart_Port GetServicePort();
|
||||
|
||||
static intptr_t max_concurrency() { return max_concurrency_; }
|
||||
static void set_max_concurrency(intptr_t value) { max_concurrency_ = value; }
|
||||
|
||||
private:
|
||||
static intptr_t max_concurrency_;
|
||||
|
||||
DISALLOW_ALLOCATION();
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(IOService);
|
||||
};
|
||||
|
||||
@@ -52,9 +52,11 @@ void IOServiceCallback(Dart_Port dest_port_id, Dart_CObject* message) {
|
||||
Dart_PostCObject(reply_port_id, result.AsApiCObject());
|
||||
}
|
||||
|
||||
intptr_t IOService::max_concurrency_ = 32;
|
||||
|
||||
Dart_Port IOService::GetServicePort() {
|
||||
return Dart_NewConcurrentNativePort("IOService", IOServiceCallback,
|
||||
/*max_concurrency=*/32);
|
||||
max_concurrency_);
|
||||
}
|
||||
|
||||
void FUNCTION_NAME(IOService_NewServicePort)(Dart_NativeArguments args) {
|
||||
|
||||
@@ -71,7 +71,12 @@ class IOService {
|
||||
|
||||
static Dart_Port GetServicePort();
|
||||
|
||||
static intptr_t max_concurrency() { return max_concurrency_; }
|
||||
static void set_max_concurrency(intptr_t value) { max_concurrency_ = value; }
|
||||
|
||||
private:
|
||||
static intptr_t max_concurrency_;
|
||||
|
||||
DISALLOW_ALLOCATION();
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(IOService);
|
||||
};
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
#include "bin/dartdev_isolate.h"
|
||||
#include "bin/error_exit.h"
|
||||
#include "bin/file_system_watcher.h"
|
||||
#if defined(DART_IO_SECURE_SOCKET_DISABLED)
|
||||
#include "bin/io_service_no_ssl.h"
|
||||
#else // defined(DART_IO_SECURE_SOCKET_DISABLED)
|
||||
#include "bin/io_service.h"
|
||||
#endif // defined(DART_IO_SECURE_SOCKET_DISABLED)
|
||||
#include "bin/options.h"
|
||||
#include "bin/platform.h"
|
||||
#include "bin/utils.h"
|
||||
@@ -606,6 +611,10 @@ bool Options::ParseArguments(int argc,
|
||||
FileSystemWatcher::set_delayed_filewatch_callback(
|
||||
Options::delayed_filewatch_callback());
|
||||
|
||||
if (Options::deterministic()) {
|
||||
IOService::set_max_concurrency(1);
|
||||
}
|
||||
|
||||
// The arguments to the VM are at positions 1 through i-1 in argv.
|
||||
Platform::SetExecutableArguments(i, argv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user