Class actor-cell

Package:

CL-GSERVER.ACTOR-CELL

Class Precedence List:

ACTOR-CELL → ... → T

Slots:

NAME
Initarg: NAME
Initform: (STRING (GENSYM actor-))
The name of the actor/actor-cell. If no name is specified a default one is applied.
STATE
Initarg: STATE
The encapsulated state.
INTERNAL-STATE
Initform: (MAKE-ACTOR-CELL-STATE)
The internal state of the server.
MSGBOX
The `message-box'. By default the `actor'/`actor-cell' has no message-box. When the actor is created through the `actor-context' of an actor, or the `actor-system' then it will be populated with a message-box.

Description:

`actor-cell' is the base of the `actor'. It is meant to encapsulate state, but also to execute async operations. State can be changed by calling into the server via `call' or `cast'. Where `call' is waiting for a result and `cast' does not. For each `call' and `cast' handlers must be implemented by subclasses.

It uses a `message-box' to processes the received messages. When the `actor'/`actor-cell' was created ad-hoc (out of the `actor-system'/`actor-context'), it will not have a message-box and can't process messages. When the `actor' is created through the `actor-system' or `actor-context', one can decide what kind of message-box/dispatcher should be used for the new `actor'.

See `actor-context' `actor-of' method for more information on this.

To stop an `actor' message handling and you can send the `:stop' message either via `call' (which will respond with `:stopped') or `cast'. This is to cleanup thread resources when the Gserver is not needed anymore.

Note: the `actor-cell' uses `call' and `cast' functions which translate to `ask-s' and `tell' on the `actor'.