blob: ea3e720ecadc5e57132b5f452bc9e2b95d71a74d (
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
|
import scala.actors.{Actor, TIMEOUT}
import Actor._
object Test {
def main(args: Array[String]) {
val a = actor {
react {
case 'hello =>
reply(42)
}
}
val b = actor {
self.trapExit = true
val ft = a !! 'hello
println(ft())
// no message should be left over in mailbox
reactWithin(0) {
case TIMEOUT =>
println("OK")
case any =>
println(any)
}
}
}
}
|