2017-03-16 23:53:18 +00:00
|
|
|
// Copyright (c) 2017, 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.
|
2019-11-27 17:23:31 +00:00
|
|
|
|
2021-04-26 17:58:57 +00:00
|
|
|
// @dart = 2.9
|
|
|
|
|
2021-07-16 09:13:28 +00:00
|
|
|
// VMOptions=--enable-isolate-groups
|
2019-11-27 17:23:31 +00:00
|
|
|
// VMOptions=--no-enable-isolate-groups
|
|
|
|
|
2017-03-16 23:53:18 +00:00
|
|
|
library regress;
|
|
|
|
|
|
|
|
import 'dart:isolate';
|
|
|
|
|
2017-04-17 21:52:57 +00:00
|
|
|
abstract class N {}
|
2017-03-16 23:53:18 +00:00
|
|
|
|
|
|
|
class J extends N {
|
|
|
|
final String s;
|
|
|
|
J(this.s);
|
|
|
|
}
|
|
|
|
|
|
|
|
class K extends N {
|
|
|
|
final int i;
|
|
|
|
K(this.i);
|
|
|
|
}
|
|
|
|
|
2017-11-17 01:14:32 +00:00
|
|
|
void isolate(Object portObj) {
|
|
|
|
SendPort port = portObj;
|
2017-03-16 23:53:18 +00:00
|
|
|
port.send(N);
|
|
|
|
port.send(new J("8" * 4));
|
2017-04-17 21:52:57 +00:00
|
|
|
for (int i = 0; i < 80000; i++) {
|
2017-03-16 23:53:18 +00:00
|
|
|
port.send(new K(i));
|
|
|
|
}
|
|
|
|
port.send('done');
|
|
|
|
}
|
|
|
|
|
|
|
|
main() async {
|
|
|
|
var recv = new RawReceivePort();
|
|
|
|
recv.handler = (k) {
|
|
|
|
if (k is J) print(k.s.length);
|
|
|
|
if (k is String) {
|
|
|
|
print(k);
|
|
|
|
recv.close();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var iso = await Isolate.spawn(isolate, recv.sendPort);
|
|
|
|
}
|