Created
July 12, 2010 03:51
-
-
Save vdichev/472114 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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