diff options
author | Philipp Haller <hallerp@gmail.com> | 2008-04-03 14:51:19 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2008-04-03 14:51:19 +0000 |
commit | d055ff17c3cd9f35c38f325c72d08f346475298a (patch) | |
tree | e13a6e68dc31395880b2d34ae385cc4847e8a8ce | |
parent | 279da87f484b6ac77d87b3efe2d69d3a09492a43 (diff) | |
download | scala-d055ff17c3cd9f35c38f325c72d08f346475298a.tar.gz scala-d055ff17c3cd9f35c38f325c72d08f346475298a.tar.bz2 scala-d055ff17c3cd9f35c38f325c72d08f346475298a.zip |
Fixed #249
-rw-r--r-- | src/actors/scala/actors/Actor.scala | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index 1d89a1590f..c413071f8a 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -19,7 +19,7 @@ import scala.compat.Platform * <code>receive</code>, <code>react</code>, <code>reply</code>, * etc. * - * @version 0.9.10 + * @version 0.9.13 * @author Philipp Haller */ object Actor { @@ -179,6 +179,13 @@ object Actor { */ def reply(): Unit = self.reply(()) + /** + * Returns the number of messages in <code>self</code>'s mailbox + * + * @return the number of messages in <code>self</code>'s mailbox + */ + def pending: Int = self.pending + private[actors] trait Body[a] { def andThen[b](other: => b): Unit } @@ -285,7 +292,7 @@ object Actor { * </li> * </ul> * - * @version 0.9.12 + * @version 0.9.13 * @author Philipp Haller */ @serializable @@ -301,6 +308,15 @@ trait Actor extends OutputChannel[Any] { private var sessions: List[OutputChannel[Any]] = Nil /** + * Returns the number of messages in this actor's mailbox + * + * @return the number of messages in this actor's mailbox + */ + def pending: Int = synchronized { + mailbox.size + } + + /** * Sends <code>msg</code> to this actor (asynchronous) supplying * explicit reply destination. * |