Skip to content

Instantly share code, notes, and snippets.

@rf
Created July 20, 2012 05:12
Show Gist options
  • Save rf/3148815 to your computer and use it in GitHub Desktop.
Save rf/3148815 to your computer and use it in GitHub Desktop.
import scala.actors._
import scala.actors.Actor._
case object Poke
case object Idling
class Kid () extends Actor {
def act () = loop {
if (mailboxSize == 0) this ! Idling
react {
case Poke => println("ow you poked me")
case Idling => println("idling lol")
}
}
}
var richard = new Kid().start
richard ! Poke
richard ! Poke
// vim: set ts=4 sw=4 et:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment