diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-05-23 03:22:01 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-05-23 03:22:01 -0700 |
commit | 0f198a63d2f1a141b43f40f639d5fff8697510d0 (patch) | |
tree | a00c180516a2714ea5107547eae766c82a799f05 /test/files/jvm/actmig-hierarchy_1.scala | |
parent | cebf241ad87358b0e8d2804750a4ac36e76f7091 (diff) | |
parent | 033463f87fe71e8f6d5b17f7cb82b8c2ea5f5271 (diff) | |
download | scala-0f198a63d2f1a141b43f40f639d5fff8697510d0.tar.gz scala-0f198a63d2f1a141b43f40f639d5fff8697510d0.tar.bz2 scala-0f198a63d2f1a141b43f40f639d5fff8697510d0.zip |
Merge pull request #575 from vjovanov/actors-migration-kit
Adding the Actor Migration Kit.
Diffstat (limited to 'test/files/jvm/actmig-hierarchy_1.scala')
-rw-r--r-- | test/files/jvm/actmig-hierarchy_1.scala | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/files/jvm/actmig-hierarchy_1.scala b/test/files/jvm/actmig-hierarchy_1.scala new file mode 100644 index 0000000000..559ebe7b11 --- /dev/null +++ b/test/files/jvm/actmig-hierarchy_1.scala @@ -0,0 +1,41 @@ +import scala.actors._ + +class ReactorActor extends Actor { + def act() { + var cond = true + loopWhile(cond) { + react { + case x: String if x == "hello1" => println(x.dropRight(1)) + case "exit" => cond = false + } + } + } +} + +class ReplyActor extends Actor { + def act() { + var cond = true + loopWhile(cond) { + react { + case "hello" => println("hello") + case "exit" => cond = false; + } + } + } +} + +object Test { + + def main(args: Array[String]) { + val reactorActor = new ReactorActor + val replyActor = new ReplyActor + reactorActor.start() + replyActor.start() + + reactorActor ! "hello1" + replyActor ! "hello" + + reactorActor ! "exit" + replyActor ! "exit" + } +} |