Nebula
Loading...
Searching...
No Matches
blockinghandlerthread.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
14#include "threading/safequeue.h"
15
16//------------------------------------------------------------------------------
17namespace Messaging
18{
20{
22public:
25
27 void SetWaitTimeout(int milliSec);
29 int GetWaitTimeout() const;
30
32 virtual void AddMessage(const Ptr<Message>& msg);
34 virtual void CancelMessage(const Ptr<Message>& msg);
35
37 virtual void EmitWakeupSignal();
39 virtual void DoWork();
40
41private:
44};
45
46//------------------------------------------------------------------------------
49inline void
51{
52 n_assert(!this->IsRunning());
53 this->waitTimeout = milliSec;
54}
55
56//------------------------------------------------------------------------------
59inline int
61{
62 return this->waitTimeout;
63}
64
65} // namespace Messaging
66//------------------------------------------------------------------------------
Message handler thread class which blocks until messages arrive (or optionally, a time-out occurs).
Definition blockinghandlerthread.h:20
void SetWaitTimeout(int milliSec)
set optional wait timeout (0 if infinite)
Definition blockinghandlerthread.h:50
virtual void CancelMessage(const Ptr< Message > &msg)
cancel a pending message (override in subclass!)
Definition blockinghandlerthread.cc:39
virtual void DoWork()
this method runs in the thread context
Definition blockinghandlerthread.cc:62
BlockingHandlerThread()
constructor
Definition blockinghandlerthread.cc:16
virtual void EmitWakeupSignal()
called if thread needs a wakeup call before stopping
Definition blockinghandlerthread.cc:51
int GetWaitTimeout() const
get wait timeout
Definition blockinghandlerthread.h:60
virtual void AddMessage(const Ptr< Message > &msg)
add a message to be handled (override in subclass!)
Definition blockinghandlerthread.cc:27
__DeclareClass(BlockingHandlerThread)
int waitTimeout
Definition blockinghandlerthread.h:42
Threading::SafeQueue< Ptr< Message > > msgQueue
Definition blockinghandlerthread.h:43
Base class for AsyncPort message handler thread classes.
Definition handlerthreadbase.h:22
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Thread-safe version of Util::Queue.
Definition safequeue.h:27
#define n_assert(exp)
Definition debug.h:50
Definition asyncport.cc:10