summaryrefslogtreecommitdiff
path: root/test/files/jvm/actor-receivewithin.scala
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2010-04-13 22:51:04 +0000
committerIulian Dragos <jaguarul@gmail.com>2010-04-13 22:51:04 +0000
commitd95eb2a8f979b9f9db98a0e097ef3793674e57ab (patch)
tree6e11ba6e02cdd30c53861d42e6e52d5ce34b8d95 /test/files/jvm/actor-receivewithin.scala
parentc272bbfb64b1d0522e09daa0981a4942f63607a4 (diff)
downloadscala-d95eb2a8f979b9f9db98a0e097ef3793674e57ab.tar.gz
scala-d95eb2a8f979b9f9db98a0e097ef3793674e57ab.tar.bz2
scala-d95eb2a8f979b9f9db98a0e097ef3793674e57ab.zip
Made the icode reader more resilient to errors.
symbol does not cause any crashes, but the method using an unknown symbol will not be used for inlining. Resurrected tests, removed spec-matrix for the moment. No review.
Diffstat (limited to 'test/files/jvm/actor-receivewithin.scala')
-rw-r--r--test/files/jvm/actor-receivewithin.scala69
1 files changed, 69 insertions, 0 deletions
diff --git a/test/files/jvm/actor-receivewithin.scala b/test/files/jvm/actor-receivewithin.scala
new file mode 100644
index 0000000000..a5c87c2722
--- /dev/null
+++ b/test/files/jvm/actor-receivewithin.scala
@@ -0,0 +1,69 @@
+import scala.actors.{Actor, TIMEOUT}
+
+object A extends Actor {
+ def act() {
+ receive {
+ case 'done =>
+ var cnt = 0
+ while (cnt < 500) {
+ cnt += 1
+ receiveWithin (0) {
+ case 'msg =>
+ if (cnt % 100 == 0)
+ println("'msg")
+ case TIMEOUT =>
+ // should not happen
+ println("FAIL1")
+ }
+ }
+ cnt = 0
+ while (cnt < 500) {
+ cnt += 1
+ receiveWithin (0) {
+ case 'msg =>
+ // should not happen
+ println("FAIL2")
+ case TIMEOUT =>
+ if (cnt % 100 == 0)
+ println("TIMEOUT")
+ }
+ }
+ B ! 'next
+ receive { case 'done => }
+ cnt = 0
+ while (cnt < 501) {
+ cnt += 1
+ receiveWithin (500) {
+ case 'msg2 =>
+ if (cnt % 100 == 0)
+ println("'msg2")
+ case TIMEOUT =>
+ println("TIMEOUT")
+ }
+ }
+ }
+ }
+}
+
+object B extends Actor {
+ def act() {
+ A.start()
+ for (_ <- 1 to 500) {
+ A ! 'msg
+ }
+ A ! 'done
+ receive {
+ case 'next =>
+ for (_ <- 1 to 500) {
+ A ! 'msg2
+ }
+ A ! 'done
+ }
+ }
+}
+
+object Test {
+ def main(args:Array[String]) {
+ B.start()
+ }
+}