Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

actor Class Reference

#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:

rt_sched_actor List of all members.


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
postmasterPostMaster
std::vector< syncreflisteners

Private Member Functions

void poll ()

Private Attributes

pthread_t m_pollthread
pthread_mutex_t m_queue_mutex
pqueue< synchstructm_msg_requests

Friends

class postmaster
void * start_polling_func_a (actor *a)

Constructor & Destructor Documentation

actor::actor const actorref name,
postmaster p
 

Constructor for the actor class.

Parameters

name
The name of this actor
p
The local postmaster to handle messages to this actor.

virtual actor::~actor  )  [inline, virtual]
 

Destructor for the actor class.


Member Function Documentation

void actor::end_polling  )  [protected]
 

Kills the polling thread. Each derived destructor shall call this before destroying any of its members.

virtual void actor::execute message m  )  [protected, pure virtual]
 

Processes a message. Inheriting classes must pass it on to its methods, as appropriate. This function shall:

  • Update the actor's current priority to reflect the running message
  • Execute the proper internal method using the parameters encoded in the message
  • Notify the external entities of message execution by calling the Postmaster.sm_ack_msg() member function with suitable timestamps
  • If the message is flagged as being synchronous, notify the postmaster of completion by calling the Postmaster.recvsyncmsg() member function to unblock the caller
  • Notify all listeners using the notify() function
  • Reset the actor's current priority
Parameters
m
The encoded message.

rttime_t actor::getpriority  )  const [virtual]
 

Returns the actor's present scheduling priority in the form of a deadline; the lower, the more urgent.

Return Value
The current scheduling priority of the actor.

Implements rt_sched_actor.

void actor::notify const method m,
const rttime_t t
[protected]
 

Notifies all listeners that an event occurred.

Parameters

m
The method that was called.
t
The time of the message.

void actor::poll  )  [private]
 

The master polling function. It iterates over the messages in the actor's internal queue and dispatches them in priority order.

void actor::register_listener const syncref s  ) 
 

Called by synchronizers to register themselves as listeners to this actor.

Parameters

s
The synchronizer that will listen to this actor.

void actor::register_msg syncref  s,
rttime_t  priority
 

Called by synchronizers to notify the actor that a message of the specified priority is waiting at synchronizer s.

Parameters

s
The synchronizer that is holding the message.
priority
The priority of the message.

void actor::start_polling  )  [protected]
 

Starts the polling thread. Each derived constructor shall call this once its members are initialized.


Friends And Related Function Documentation

friend class postmaster [friend]
 

void* start_polling_func_a actor a  )  [friend]
 


Member Data Documentation

std::vector<syncref> actor::listeners [protected]
 

The listeners to this actor.

pqueue<synchstruct> actor::m_msg_requests [private]
 

The message requests for this actor (external entities do not queue messages, but notifications that messages are waiting).

pthread_t actor::m_pollthread [private]
 

ID of the polling thread.

pthread_mutex_t actor::m_queue_mutex [private]
 

Mutex to handle synchronization of m_msg_requests.

const actorref actor::name [protected]
 

Name of this actor.

postmaster& actor::PostMaster [protected]
 

The local postmaster.

rttime_t actor::rt_current [protected]
 

The priority of the message currently being processed.

rttime_t actor::rt_highest [protected]
 

The highest priority of a message in the queue.


The documentation for this class was generated from the following files:
Generated on Wed May 24 23:03:25 2006 for RTSync by  doxygen 1.4.4