#include <actor.h>
This provides the abstract base class for
actors (see
docs/actor_concepts). Concrete actors are generated from user RTSync
code and shall provide suitable constructors and an implementation
for the virtual execute() function.
An actor basically functions by associating
itself with a postmaster and setting up a polling thread. External
entities may, through the postmaster, feed it new messages; the
polling thread shall iterate and select suitable messages from an
internal queue, which the execute() function dispatches.
Inheritance diagram for actor:
Public Member Functions | |
actor (const actorref &name, postmaster &p) | |
virtual | ~actor () |
rttime_t | getpriority () const |
void | register_msg (syncref s, rttime_t priority) |
void | register_listener (const syncref &s) |
Protected Member Functions | |
void | notify (const method &m, const rttime_t &t) |
void | start_polling () |
void | end_polling () |
virtual void | execute (message &m)=0 |
Protected Attributes | |
rttime_t | rt_current |
rttime_t | rt_highest |
const actorref | name |
postmaster & | PostMaster |
std::vector< syncref > | listeners |
Private Member Functions | |
void | poll () |
Private Attributes | |
pthread_t | m_pollthread |
pthread_mutex_t | m_queue_mutex |
pqueue< synchstruct > | m_msg_requests |
Friends | |
class | postmaster |
void * | start_polling_func_a (actor *a) |
|
Constructor for the actor class.
|
|
Destructor for the actor class. |
|
Kills the polling thread. Each derived destructor shall call this before destroying any of its members. |
|
Processes a message. Inheriting classes must pass it on to its methods, as appropriate. This function shall:
|
|
Returns the actor's present scheduling priority in the form of a
deadline; the lower, the more urgent.
Implements rt_sched_actor. |
|
Notifies all listeners that an event occurred.
|
|
The master polling function. It iterates over the messages in the actor's internal queue and dispatches them in priority order. |
|
Called by synchronizers to register themselves as listeners to this
actor.
|
|
Called by synchronizers to notify the actor that a message of the
specified priority is waiting at synchronizer s.
|
|
Starts the polling thread. Each derived constructor shall call this once its members are initialized. |
|
|
|
|
|
The listeners to this actor. |
|
The message requests for this actor (external entities do not queue messages, but notifications that messages are waiting). |
|
ID of the polling thread. |
|
Mutex to handle synchronization of m_msg_requests. |
|
Name of this actor. |
|
The local postmaster. |
|
The priority of the message currently being processed. |
|
The highest priority of a message in the queue. |