Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Unified Diff: tests/standalone/io/signals_test_script.dart

Issue 119093007: Signal handling, take 2. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/io/signals_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/signals_test_script.dart
diff --git a/tests/standalone/io/signals_test_script.dart b/tests/standalone/io/signals_test_script.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5a2c7bc4b6fac386bcb3ecb42085b66490e8dfbb
--- /dev/null
+++ b/tests/standalone/io/signals_test_script.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2013, 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:io";
+
+void main(args) {
+ int usr1Count = int.parse(args[0]);
+ int usr2Count = int.parse(args[1]);
+ var sub1;
+ var sub2;
+ void check() {
+ if (usr1Count < 0 || usr2Count < 0) exit(1);
+ if (usr1Count == 0 && usr2Count == 0) {
+ sub1.cancel();
+ sub2.cancel();
+ }
+ print("ready");
+ }
+ sub1 = ProcessSignal.SIGUSR1.watch().listen((signal) {
+ if (signal != ProcessSignal.SIGUSR1) exit(1);
+ usr1Count--;
+ check();
+ });
+ sub2 = ProcessSignal.SIGUSR2.watch().listen((signal) {
+ if (signal != ProcessSignal.SIGUSR2) exit(1);
+ usr2Count--;
+ check();
+ });
+ check();
+}
« no previous file with comments | « tests/standalone/io/signals_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698