80ec90e13c
Change-Id: Ie8c9121a1d7fc36eb8a7d9b1e599fd913cacb024 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161469 Auto-Submit: Mike Fairhurst <mfairhurst@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com> Reviewed-by: Ben Konyi <bkonyi@google.com>
54 lines
1.0 KiB
Dart
54 lines
1.0 KiB
Dart
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:isolate';
|
|
|
|
main(List<String> args) async {
|
|
var arr = newArray(5);
|
|
var arr2 = newArray(417);
|
|
var hash1 = newHash(5);
|
|
var hash2 = newHash(417);
|
|
|
|
// ignore unused
|
|
arr.length;
|
|
arr2.length;
|
|
hash1.length;
|
|
hash2.length;
|
|
|
|
startIsolate(1);
|
|
startIsolate(2);
|
|
startIsolate(3);
|
|
startIsolate(4);
|
|
|
|
await Future.delayed(Duration(seconds: 5));
|
|
|
|
print('at end of main...');
|
|
}
|
|
|
|
void startIsolate(int val) {
|
|
Isolate.spawn(isolateEntry, val);
|
|
}
|
|
|
|
isolateEntry(message) async {
|
|
print('starting $message');
|
|
await Future.delayed(Duration(seconds: message));
|
|
print('ending $message');
|
|
}
|
|
|
|
List newArray(int length) {
|
|
List l = [];
|
|
for (int i = 0; i < length; i++) {
|
|
l.add('entry_$i');
|
|
}
|
|
return l;
|
|
}
|
|
|
|
Map newHash(int length) {
|
|
Map m = {};
|
|
for (int i = 0; i < length; i++) {
|
|
m['entry_$i'] = i;
|
|
}
|
|
return m;
|
|
}
|