mbo::MboEventThread Class Reference

An event driven thread implementation. More...

#include <MboThread.h>

Inheritance diagram for mbo::MboEventThread:

Inheritance graph
{mbo::MboDelayedEventThread\n|- m_mxDelay\l- m_nDelay\l- m_hDelay\l|+ MboDelayedEventThread()\l+ ~MboDelayedEventThread()\l+ Stop()\l+ SetDelay()\l+ GetDelay()\l- ThreadProc()\l- operator=()\l}{mbo::MboThread\n|# m_hThread\l# m_hIsStopping\l# m_dwThreadId\l# m_mxStartStop\l- m_szThreadName\l|+ MboThread()\l+ MboThread()\l+ ~MboThread()\l+ IsRunning()\l+ IsStopping()\l+ WaitFor()\l+ KillThread()\l+ GetThreadId()\l+ SetThreadPriority()\l+ GetThreadName()\l+ Action()\l+ OnActionException()\l+ Start()\l+ Stop()\l+ OnThreadStart()\l+ OnThreadStop()\l+ SetThreadName()\l# ThreadProc()\l- ThreadProcCaller()\l- ThreadNamer()\l- ThreadProcRunner()\l- ForceThreadName()\l- operator=()\l}
[legend]
Collaboration diagram for mbo::MboEventThread:

Collaboration graph
{mbo::MboThread\n|# m_hThread\l# m_hIsStopping\l# m_dwThreadId\l# m_mxStartStop\l- m_szThreadName\l|+ MboThread()\l+ MboThread()\l+ ~MboThread()\l+ IsRunning()\l+ IsStopping()\l+ WaitFor()\l+ KillThread()\l+ GetThreadId()\l+ SetThreadPriority()\l+ GetThreadName()\l+ Action()\l+ OnActionException()\l+ Start()\l+ Stop()\l+ OnThreadStart()\l+ OnThreadStop()\l+ SetThreadName()\l# ThreadProc()\l- ThreadProcCaller()\l- ThreadNamer()\l- ThreadProcRunner()\l- ForceThreadName()\l- operator=()\l}{mbo::CCriticalSectionImpl\n|- m_cs\l|+ CCriticalSectionImpl()\l+ ~CCriticalSectionImpl()\l+ Enter()\l+ Leave()\l+ GetLock()\l+ GetLevel()\l}{mbo::ICriticalSection\n||+ ~ICriticalSection()\l+ Enter()\l+ Leave()\l+ GetLock()\l+ GetLevel()\l}
[legend]

List of all members.

Public Member Functions

 MboEventThread (bool bAutoStart=true, const char *szThreadName=NULL)
virtual ~MboEventThread ()
IncDecVal GetCounter () const
void SetEvent () const
virtual bool IsSignaled () const
virtual void Stop ()

Friends

class MboDelayedEventThread


Detailed Description

An event driven thread implementation.

The derived class MboEventThread implements an endless loop that waits for an event to occur (SetEvent) between each calls of Action(). The callbacks OnThreadStart()/OnThreadStop() are only called once.

Note:
This class is distributed under the following license GNU Lesser General Public License, version 2.1.

Definition at line 387 of file MboThread.h.


Constructor & Destructor Documentation

mbo::MboEventThread::MboEventThread ( bool  bAutoStart = true,
const char *  szThreadName = NULL 
) [explicit]

constructor

Parameters:
bAutoStart whether to automatically start the event thread.
szThreadName The name of the thread. The new class instance will copy the value and free its copy automatically upon destruction. You may want to use NULL to use the class name of as the thread name. If you do so the name is computed in thread startup - this only works if this is not done in constructor. If done so the name you will see is the name of that parent class whose constructor started the thread.
Note:
You can see thread names only in MSVC.NET and above or MSVC.6-SP2.

virtual mbo::MboEventThread::~MboEventThread (  )  [virtual]

destructor


Member Function Documentation

IncDecVal mbo::MboEventThread::GetCounter (  )  const

Counts the execution times of Action()

Note:
Since the delay may be skipped ht ecounter is incremented right before calling Action() and not after receiving the event by a call to SetEvent().
Returns:
number of times Action() was invoked

void mbo::MboEventThread::SetEvent (  )  const

Set event which results in calling execute if the thread is running.

virtual bool mbo::MboEventThread::IsSignaled (  )  const [virtual]

Check whether the thread is signaled. That is the thread event has been set and either the delay hasn't elapsed or the Action() wasn't finished already.

Returns:
Whether thread is signaled.

virtual void mbo::MboEventThread::Stop (  )  [virtual]

Stop the thread.

This stops the thread by signaling it and skipping the delay. Neither Action() is called nor will the Action() counter be incremented.

Reimplemented from mbo::MboThread.

Reimplemented in mbo::MboDelayedEventThread.


Friends And Related Function Documentation

friend class MboDelayedEventThread [friend]

Definition at line 389 of file MboThread.h.


The documentation for this class was generated from the following file:
  Hosted on code.google.com  
© Marcus Börger
Generated on Fri Jan 18 21:21:13 2008 for MBO-lib by doxygen 1.5.4