From 2b51d5c4772d480285359b9d2daf8b1ccef3eae4 Mon Sep 17 00:00:00 2001 From: Philipp Haller Date: Tue, 21 Jul 2009 08:25:35 +0000 Subject: Made daemon-actor-termination test deterministic. --- test/files/jvm/daemon-actor-termination.scala | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/test/files/jvm/daemon-actor-termination.scala b/test/files/jvm/daemon-actor-termination.scala index 824bd76211..b089f652bf 100644 --- a/test/files/jvm/daemon-actor-termination.scala +++ b/test/files/jvm/daemon-actor-termination.scala @@ -13,15 +13,24 @@ object Test { class MyDaemon extends DaemonActor { def act() { - println("MSG1") - Thread.sleep(5000) - println("done") + react { + case 'hello => + println("MSG1") + reply() + react { + case 'bye => + println("done") + } + } } } + def main(args: Array[String]) { val daemon = new MyDaemon daemon.start() - Thread.sleep(500) // give the daemon a chance to start - println("MSG2") + Actor.actor { + daemon !? 'hello + println("MSG2") + } } } -- cgit v1.2.3