From bf639030734f9eed8c07342fb30e5d4fc94d850b Mon Sep 17 00:00:00 2001 From: Philipp Haller Date: Mon, 28 Jun 2010 23:28:02 +0000 Subject: Added doc comment to Actor trait explaining the... Added doc comment to Actor trait explaining the use of thread-blocking methods. --- src/actors/scala/actors/Actor.scala | 41 +++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index 8caa624f67..f49dd2e247 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -357,9 +357,45 @@ object Actor extends Combinators { /** *

- * This class provides an implementation of event-based actors. - * The main ideas of our approach are explained in the two papers + * This trait provides lightweight, concurrent actors. Actors are + * created by extending the `Actor` trait (alternatively, one of the + * factory methods in its companion object can be used). The + * behavior of an `Actor` subclass is defined by implementing its + * `act` method: + * + * {{{ + * class MyActor extends Actor { + * def act() { + * // actor behavior goes here + * } + * } + * }}} + * + * A new `Actor` instance is started by invoking its `start` method. + * + * '''Note:''' care must be taken when invoking thread-blocking methods + * other than those provided by the `Actor` trait or its companion + * object (such as `receive`). Blocking the underlying thread inside + * an actor may lead to starvation of other actors. This also + * applies to actors hogging their thread for a long time between + * invoking `receive`/`react`. + * + * If actors use blocking operations (for example, methods for + * blocking I/O), there are several options: + *

*

+ *

+ * The main ideas of the implementation are explained in the two papers *

+ *

* * @author Philipp Haller * -- cgit v1.2.3