summaryrefslogtreecommitdiff
path: root/test/files/jvm/replyreactor.scala
blob: fb915cf3f94b9560c7e9a71770830f9990076cfc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import scala.actors.ReplyReactor

object Test {
  def main(args: Array[String]) {
    val a = new ReplyReactor {
      def act() {
        react {
          case 'hello =>
            sender ! 'hello
        }
      }
    }
    a.start()

    val b = new ReplyReactor {
      def act() {
        react {
          case r: ReplyReactor =>
            r ! 'hello
            react {
              case any =>
                println(any)
            }
        }
      }
    }
    b.start()

    b ! a
  }
}