diff options
Diffstat (limited to 'docs/examples/actors')
-rw-r--r-- | docs/examples/actors/pingpong.scala | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/docs/examples/actors/pingpong.scala b/docs/examples/actors/pingpong.scala index e270116097..336df74465 100644 --- a/docs/examples/actors/pingpong.scala +++ b/docs/examples/actors/pingpong.scala @@ -7,6 +7,20 @@ case object Ping case object Pong case object Stop +/** + * Ping pong example. + * + * @author Philipp Haller + * @version 1.1 + */ +object pingpong extends Application { + val pong = new Pong + val ping = new Ping(100000, pong) + ping.start + pong.start + ping ! SendPing +} + class Ping(count: int, pong: Actor) extends Actor { def act() { var pingsLeft = count - 1 @@ -46,10 +60,3 @@ class Pong extends Actor { } } } - -object pingpong extends Application { - val pong = new Pong - val ping = new Ping(100000, pong) - ping.start - pong.start -} |