diff options
Diffstat (limited to 'sources/scala/concurrent/Actor.scala')
-rw-r--r-- | sources/scala/concurrent/Actor.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sources/scala/concurrent/Actor.scala b/sources/scala/concurrent/Actor.scala new file mode 100644 index 0000000000..f6a1447f0e --- /dev/null +++ b/sources/scala/concurrent/Actor.scala @@ -0,0 +1,15 @@ +package scala.concurrent; + +abstract class Actor() extends Thread() { + + type Message = AnyRef; + + private val mb = new MailBox(); + + def send(msg: Message): Unit = + mb.send(msg); + def receive[a](f: PartialFunction[Message, a]): a = + mb.receive(f); + def receiveWithin[a](msec: Long)(f: PartialFunction[Message, a]): a = + mb.receiveWithin(msec)(f); +}
\ No newline at end of file |