|
EpcTools
An event based multi-threaded C++ development framework.
|
Represents a worker thread that is part of a work group. More...
#include <etevent.h>
Public Member Functions | |
| Int | workerId () const |
| virtual Void | onInit () |
| Called in the context of the thread prior to processing teh first event message. More... | |
| virtual Void | onQuit () |
| Called in the context of the thread when the EM_QUIT event is processed. More... | |
| virtual Void | onTimer (EThreadEventTimer *ptimer) |
| Called in the context of the thread when th EM_TIMER event is processed. More... | |
| ESemaphoreData & | getMsgSemaphore () |
| Returns the semaphore associated with this work groups' event queue. More... | |
| Bool | sendMessage (UInt message, Bool wait=True) |
| Sends event message to this work group. More... | |
| Bool | sendMessage (UInt message, pVoid voidptr, Bool wait=True) |
| Sends event message to this work group. More... | |
| Bool | sendMessage (const TMessage &msg, Bool wait=True) |
| Sends event message to this work group. More... | |
Public Member Functions inherited from EThreadBasic | |
| EThreadBasic () | |
| Class constructor. More... | |
| virtual | ~EThreadBasic () |
| Class destructor. More... | |
| Void | init (pVoid arg, size_t stackSize=0) |
| Initialize and start the thread. More... | |
| Void | join () |
| Waits for the thread to terminate. More... | |
| Bool | isInitialized () |
| Returns the thread initialization state. More... | |
| RunState | getRunState () |
| Returns the current thread run state. More... | |
| Bool | isWaitingToRun () |
| Determines if the thread is waiting to run. More... | |
| Bool | isRunning () |
| Determines if the thread is running. More... | |
| Bool | isDoneRunning () |
| Determines if the thread has finished running. More... | |
| Int | cancelWait () |
| Sends a cancellation request to the thread. More... | |
| Void | signal (Int sig) |
Protected Member Functions | |
| EThreadEventWorker () | |
| Default class constructor. More... | |
| ~EThreadEventWorker () | |
| The class destructor. More... | |
| virtual Void | onMessageQueued (const TMessage &msg) |
| Called when an event message is queued. More... | |
| virtual Void | init (TQueue &queue, Int workerid, pVoid arg, Dword stackSize=0) |
| Initializes the thread object. More... | |
| Void | start () |
| Initializes the thread when it was suspended at init(). More... | |
| Bool | pumpMessage (TMessage &msg, Bool wait=true) |
| Dispatches the next thread event message. More... | |
| virtual Void | pumpMessages () |
| Process event messages. More... | |
| virtual Void | defaultMessageHandler (TMessage &msg) |
| The default event message handler. More... | |
| pid_t | getThreadId () |
| Retrieves the internal thread ID. More... | |
Friends | |
| template<class T1 , class T2 , class T3 > | |
| class | EThreadEventWorkGroup |
Additional Inherited Members | |
Public Types inherited from EThreadBasic | |
| enum | RunState { rsWaitingToRun, rsRunning, rsDoneRunning } |
| EThreadBasic run states. More... | |
Static Public Member Functions inherited from EThreadBasic | |
| static Void | sleep (Int milliseconds) |
| Sleeps for the specified number of milliseconds. More... | |
| static Void | yield () |
| Relinquishes the CPU. More... | |
Static Protected Member Functions inherited from EThreadBasic | |
| static Void | Initialize () |
| performs internal initialization *** DO NOT CALL *** More... | |
| static Void | UnInitialize () |
| performs internal de-initialization *** DO NOT CALL *** More... | |
Represents a worker thread that is part of a work group.
|
inlineprotected |
Default class constructor.
|
inlineprotected |
The class destructor.
|
inlineprotectedvirtual |
The default event message handler.
| msg | the EThreadMessage event object |
This method is called when no event handler has been defined in the class heirarchy for a specified thread event.
|
inline |
Returns the semaphore associated with this work groups' event queue.
|
inlineprotected |
Retrieves the internal thread ID.
|
inlineprotectedvirtual |
Initializes the thread object.
| queue | a reference to the work group event queue. |
| workerid | identifies the worker thread within the work group. |
| arg | an argument that will be passed through to the internal thread procedure. Currently not used. |
| stackSize | the stack size. |
|
inlinevirtual |
Called in the context of the thread prior to processing teh first event message.
Reimplemented in PFCP::ApplicationWorker.
|
inlineprotectedvirtual |
Called when an event message is queued.
| msg | the message object that has been queued. |
This method is called in the context of the thread where sendMessage() is called after the message has been added to the thread's event queue.
|
inlinevirtual |
Called in the context of the thread when the EM_QUIT event is processed.
Reimplemented in PFCP::ApplicationWorker.
|
inlinevirtual |
Called in the context of the thread when th EM_TIMER event is processed.
| ptimer | a pointer to the EThreadBase::Timer object that expired |
|
inlineprotected |
Dispatches the next thread event message.
| msg | the EThreadMessage event object |
| wait | waits for the next EThreadMessage to be processed |
This method retrieves the next event message from the threads event queue and processes the event by calling the first event handler as defined by the class heirarchy. If no event message is available and the wait parameter is true, then the thread will block waiting on the next event message to be sent to the thread. If there is no event handler defined in the class heirarchy for a particular event ID, the default event handler, defMessageHandler(), will be called.
|
inlineprotectedvirtual |
Process event messages.
| EError | catches and re-throws any exception raised by pumpMessage |
Any overridden version of pumpMessages() must call pumpMessage() to process each individual message.
|
inline |
Sends event message to this work group.
| message | the message ID |
| wait | waits for the message to be sent |
Sends (posts) an event message to the work group event queue. No additional data is posted with the event.
|
inline |
Sends event message to this work group.
| message | the message ID. |
| voidptr | a void pointer to be included with the message. |
| wait | waits for the message to be sent. |
Sends (posts) an event message to the work group event queue. No additional data is posted with the event.
|
inline |
Sends event message to this work group.
| msg | the message object that has been queued. |
| wait | waits for the message to be sent |
Sends (posts) the supplied event message to the work groups' event queue.
|
inlineprotected |
Initializes the thread when it was suspended at init().
|
inline |
|
friend |
1.8.11