Nebula
Loading...
Searching...
No Matches
handlerthreadbase.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12#include "threading/thread.h"
13#include "threading/event.h"
15#include "messaging/handler.h"
16#include "messaging/message.h"
17
18//------------------------------------------------------------------------------
19namespace Messaging
20{
68
69} // namespace Messaging
70//------------------------------------------------------------------------------
Base class for AsyncPort message handler thread classes.
Definition handlerthreadbase.h:22
Threading::CriticalSection handlersCritSect
Definition handlerthreadbase.h:64
__DeclareClass(HandlerThreadBase)
bool ThreadHandleMessages(const Util::Array< Ptr< Message > > &msgArray)
handle messages in array, return true if at least one message has been handled
Definition handlerthreadbase.cc:223
void WaitForHandlersOpened()
wait until handlers have been opened
Definition handlerthreadbase.cc:73
void AttachHandler(const Ptr< Handler > &h)
attach a message handler
Definition handlerthreadbase.cc:31
void ThreadUpdateHandlers()
open dynamically added handlers, and call DoWork() on all attached handlers
Definition handlerthreadbase.cc:159
bool ThreadHandleSingleMessage(const Ptr< Message > &msg)
handle a single message without deferred support, return if message has been handled
Definition handlerthreadbase.cc:263
void RemoveHandler(const Ptr< Handler > &h)
dynamically remove a message handler
Definition handlerthreadbase.cc:45
Threading::Event msgHandledEvent
Definition handlerthreadbase.h:62
void ThreadDiscardDeferredMessages()
clear leftover deferred messages
Definition handlerthreadbase.cc:211
HandlerThreadBase()
constructor
Definition handlerthreadbase.cc:20
Util::Array< Ptr< Message > > deferredMessages
Definition handlerthreadbase.h:66
virtual void AddMessage(const Ptr< Message > &msg)
add a message to be handled (override in subclass!)
Definition handlerthreadbase.cc:85
Util::Array< Ptr< Handler > > handlers
Definition handlerthreadbase.h:65
virtual void CancelMessage(const Ptr< Message > &msg)
cancel a pending message (override in subclass!)
Definition handlerthreadbase.cc:96
void ClearHandlers()
clear all attached message handlers
Definition handlerthreadbase.cc:60
Threading::Event handlersOpenedEvent
Definition handlerthreadbase.h:63
void ThreadOpenHandlers()
open message handlers
Definition handlerthreadbase.cc:123
bool ThreadUpdateDeferredMessages()
update deferred messages, return true if at least one message has been handled
Definition handlerthreadbase.cc:188
virtual void WaitForMessage(const Ptr< Message > &msg)
wait for message to be handled (optionally override in subclass!)
Definition handlerthreadbase.cc:109
void ThreadCloseHandlers()
close message handlers
Definition handlerthreadbase.cc:141
void ThreadSignalMessageHandled()
signal message handled event (only call if at least one message has been handled)
Definition handlerthreadbase.cc:315
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Critical section objects are used to protect a portion of code from parallel execution.
Nebula's dynamic array class.
Definition array.h:60
Definition asyncport.cc:10