Nebula
|
#include <blockinghandlerthread.h>
Message handler thread class which blocks until messages arrive (or optionally, a time-out occurs).
Inherits Messaging::HandlerThreadBase.
Public Member Functions | |
BlockingHandlerThread () | |
constructor | |
void | SetWaitTimeout (int milliSec) |
set optional wait timeout (0 if infinite) | |
int | GetWaitTimeout () const |
get wait timeout | |
virtual void | AddMessage (const Ptr< Message > &msg) |
add a message to be handled (override in subclass!) | |
virtual void | CancelMessage (const Ptr< Message > &msg) |
cancel a pending message (override in subclass!) | |
virtual void | EmitWakeupSignal () |
called if thread needs a wakeup call before stopping | |
virtual void | DoWork () |
this method runs in the thread context | |
Public Member Functions inherited from Messaging::HandlerThreadBase | |
HandlerThreadBase () | |
constructor | |
void | AttachHandler (const Ptr< Handler > &h) |
attach a message handler | |
void | RemoveHandler (const Ptr< Handler > &h) |
dynamically remove a message handler | |
void | ClearHandlers () |
clear all attached message handlers | |
void | WaitForHandlersOpened () |
wait until handlers have been opened | |
virtual void | WaitForMessage (const Ptr< Message > &msg) |
wait for message to be handled (optionally override in subclass!) | |
Private Member Functions | |
__DeclareClass (BlockingHandlerThread) | |
Private Attributes | |
int | waitTimeout |
Threading::SafeQueue< Ptr< Message > > | msgQueue |
Additional Inherited Members | |
Protected Member Functions inherited from Messaging::HandlerThreadBase | |
void | ThreadOpenHandlers () |
open message handlers | |
void | ThreadCloseHandlers () |
close message handlers | |
void | ThreadUpdateHandlers () |
open dynamically added handlers, and call DoWork() on all attached handlers | |
bool | ThreadUpdateDeferredMessages () |
update deferred messages, return true if at least one message has been handled | |
void | ThreadDiscardDeferredMessages () |
clear leftover deferred messages | |
bool | ThreadHandleMessages (const Util::Array< Ptr< Message > > &msgArray) |
handle messages in array, return true if at least one message has been handled | |
bool | ThreadHandleSingleMessage (const Ptr< Message > &msg) |
handle a single message without deferred support, return if message has been handled | |
void | ThreadSignalMessageHandled () |
signal message handled event (only call if at least one message has been handled) | |
Protected Attributes inherited from Messaging::HandlerThreadBase | |
Threading::Event | msgHandledEvent |
Threading::Event | handlersOpenedEvent |
Threading::CriticalSection | handlersCritSect |
Util::Array< Ptr< Handler > > | handlers |
Util::Array< Ptr< Message > > | deferredMessages |
Messaging::BlockingHandlerThread::BlockingHandlerThread | ( | ) |
constructor
|
private |
add a message to be handled (override in subclass!)
This adds a new message to the thread's message queue.
Reimplemented from Messaging::HandlerThreadBase.
cancel a pending message (override in subclass!)
This removes a message from the thread's message queue, regardless of its state.
Reimplemented from Messaging::HandlerThreadBase.
|
virtual |
this method runs in the thread context
The message processing loop.
|
virtual |
called if thread needs a wakeup call before stopping
This method is called by Thread::Stop() after setting the stopRequest event and before waiting for the thread to stop.
|
inline |
get wait timeout
|
inline |
set optional wait timeout (0 if infinite)
|
private |
|
private |