blob: 0c08a5f283d505947993f354937d93fe6397a87c [file] [log] [blame]
* 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.
* @assertion void removeOnExitListener(
* SendPort responsePort
* )
* Stop listening on exit messages from the isolate.
* If a call has previously been made to addOnExitListener with the same
* send-port, this will unregister the port, and it will no longer receive
* a message when the isolate terminates. A response may still be sent until
* this operation is fully processed by the isolate.
* @description Check that given port does not receive events after call
* to removeOnExitListener().
* @author
import "dart:isolate";
import "dart:async";
import "../../../Utils/expect.dart";
import "IsolateUtil.dart";
test() async {
// setup
ReceivePort receivePort = new ReceivePort();
ReceivePort onExit = new ReceivePort();
Future onExitFuture = onExit.first;
EchoServer server = await EchoServer.spawn(receivePort.sendPort);
// do something
await receivePort.first;
await server.stop();
onExitFuture = onExitFuture.timeout(
new Duration(milliseconds:200),
onTimeout:() => "timeout"
Expect.equals("timeout", await onExitFuture);
// clean up
main() {