summaryrefslogtreecommitdiff
path: root/test/files/jvm/replyablereactor4.scala
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2009-07-21 17:35:01 +0000
committerPhilipp Haller <hallerp@gmail.com>2009-07-21 17:35:01 +0000
commitd063a9fa5162bf6f59b34d653b46534830310a50 (patch)
treefd9dfd389c834d3091fe37b86e720ede940d6850 /test/files/jvm/replyablereactor4.scala
parent9e896451708d850d5bc3b3d27d169f09aece912b (diff)
downloadscala-d063a9fa5162bf6f59b34d653b46534830310a50.tar.gz
scala-d063a9fa5162bf6f59b34d653b46534830310a50.tar.bz2
scala-d063a9fa5162bf6f59b34d653b46534830310a50.zip
Enabled synchronous message sends for Replyable...
Enabled synchronous message sends for ReplyableReactor. Added get(timeout: Long) method to SyncVar.
Diffstat (limited to 'test/files/jvm/replyablereactor4.scala')
-rw-r--r--test/files/jvm/replyablereactor4.scala44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/files/jvm/replyablereactor4.scala b/test/files/jvm/replyablereactor4.scala
new file mode 100644
index 0000000000..f09e32e356
--- /dev/null
+++ b/test/files/jvm/replyablereactor4.scala
@@ -0,0 +1,44 @@
+import scala.actors._
+import scala.actors.Actor._
+
+class MyActor extends ReplyReactor with ReplyableReactor {
+ def act() {
+ loop {
+ react {
+ case 'hello =>
+ sender ! 'hello
+ case 'stop =>
+ exit()
+ }
+ }
+ }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ val a = new MyActor
+ a.start()
+
+ val b = new Reactor {
+ def act() {
+ react {
+ case r: MyActor =>
+ var i = 0
+ loop {
+ i += 1
+ val msg = r !? (500, 'hello)
+ if (i % 10000 == 0)
+ println(msg)
+ if (i >= 50000) {
+ r ! 'stop
+ exit()
+ }
+ }
+ }
+ }
+ }
+ b.start()
+
+ b ! a
+ }
+}