Skip to content

Instantly share code, notes, and snippets.

@vdichev
Created July 12, 2010 03:51
Show Gist options
  • Select an option

  • Save vdichev/472114 to your computer and use it in GitHub Desktop.

Select an option

Save vdichev/472114 to your computer and use it in GitHub Desktop.
import scala.actors._
import Actor._
case object DoIt
val worker = actor {
loop {
react {
case DoIt => println("Time for work at " + new java.util.Date())
}
}
}
val scheduler = actor {
loop {
reactWithin(5000L) {
case TIMEOUT => worker ! DoIt
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment