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

dtpf::EventLooper Class Reference

#include <EventLooper.h>

List of all members.


Detailed Description

Runs a message handling thread for a DTPF Node.

EventLooper spawns a new thread of execution to listen for muscle::Message arriving on a slayer::PacketPort. Arriving messages are filtered for messages intended for the EventLooper or its Node and dispatches the messages accordingly.

EventLoopers are created by the framework on behalf of client code or when registering a node that doesn't have an associated looper.

Currently each EventLooper is associated with one Node. In the future this may be changed to allow one EventLooper to handle messaging for more than one Node reduce the number of threads needed for some Node network configurations.


Public Member Functions

status_t AddNode (Node *node)
 Tell an EventLooper to begin handling messaging for a given Node.
status_t RemoveNode (Node *node)
 Remove a Node from an EventLooper.
status_t AcquireLock ()
 Acquire the EventLooper synchronization lock.
status_t ReleaseLock ()
 Release the EventLooper synchronization lock.

Protected Member Functions

 EventLooper ()
 Create a new EventLooper.
virtual ~EventLooper ()
 Delete and EventLooper.
virtual void MessageReceived (muscle::Message *message)
 This is called from the message handling thread with the EventLooper lock held to handle an incoming message.
status_t StartMessageThread ()
 Start the message handling thread.
status_t StopMessaageThread ()
 Stop the message handling thread.


Constructor & Destructor Documentation

dtpf::EventLooper::EventLooper  )  [protected]
 

Create a new EventLooper.

The message handling thread will need to be started before the new EventLooper can handle messages.

virtual dtpf::EventLooper::~EventLooper  )  [protected, virtual]
 

Delete and EventLooper.

The message handling thread will be stopped if it is running.


Member Function Documentation

status_t dtpf::EventLooper::AcquireLock  ) 
 

Acquire the EventLooper synchronization lock.

Returns:
E_OK if the lock was successfully acquired.

E_ERROR if there was a problem acquiring the lock

status_t dtpf::EventLooper::AddNode Node node  ) 
 

Tell an EventLooper to begin handling messaging for a given Node.

Parameters:
node The Node to begin handling messaging for.
Returns:
E_OK if the addition was successful.

E_??? if the addition failed because the EventLooper is already assigned to a Node.

virtual void dtpf::EventLooper::MessageReceived muscle::Message *  message  )  [protected, virtual]
 

This is called from the message handling thread with the EventLooper lock held to handle an incoming message.

Implementations of this should be sure to call through to slayer::Server::MessageReceived() if the message is not handled.

See also:
slayer::Server::MessageReceived()
Parameters:
message The incoming message, the caller retains ownership of this message.

status_t dtpf::EventLooper::ReleaseLock  ) 
 

Release the EventLooper synchronization lock.

Returns:
E_OK if the lock was successfully released.

E_ERROR if the calling thread doesn't own the lock or there was a problem releasing the lock

status_t dtpf::EventLooper::RemoveNode Node node  ) 
 

Remove a Node from an EventLooper.

The EventLooper will stop handling messaging for the given Node.

Parameters:
node The Node to stop handling messaging for.
Returns:
E_OK if successful.

E_??? if the EventLooper isn't handling messaging for node.

status_t dtpf::EventLooper::StartMessageThread  )  [protected]
 

Start the message handling thread.

Returns:
E_OK if successful.

E_ERROR if there was an error starting the message handling thread.

status_t dtpf::EventLooper::StopMessaageThread  )  [protected]
 

Stop the message handling thread.

Returns:
E_OK if the message handling thread was successfully stopped.

E_ERROR if the thread wasn't started or there was an error stopping it.


The documentation for this class was generated from the following file:
Generated on Wed Aug 3 07:26:19 2005 for DTPF by  doxygen 1.3.9.1