QTimerDispatcher Class Reference

List of all members.


Detailed Description

handler for QTimer objects

Sergio Di Domizio The only purpose of this class is to create a separate thread and execute the event_base_dispatch() function (from libevent)

Public Member Functions

 ~QTimerDispatcher ()
 dtor
void AddTimer ()
 initialize and launch event dispatching thread if it is not already active
bool HasError () const
 chech whether an error occurred in the event dispatch thread
void SetError (const QError &err)
 set error
const QErrorGetError () const
 get error
void Cleanup ()
bool ThreadDone ()

Static Public Member Functions

static QTimerDispatcherGetInstance ()
 singleton getter

Private Member Functions

 QTimerDispatcher ()
 ctor perform event library initialization
void ExecuteThread ()
 actually executes the second thread
void CheckStatus ()

Static Private Member Functions

static void * ThreadEntryPoint (void *ptr)
 utility method conforming to the interface requested by pthread
static void EventEntryPoint (int fd, short event, void *ptr)

Private Attributes

pthread_t fThread
void * fEvBase
QError fError
bool fDoExit
struct event fEvent
struct timeval fTimeout
QSemaphore fSemaphore

Static Private Attributes

static pthread_mutex_t fThreadMutex = PTHREAD_MUTEX_INITIALIZER


Member Function Documentation

void QTimerDispatcher::AddTimer (  ) 

initialize and launch event dispatching thread if it is not already active

This method must be called by QTimer in QTimer::Start() to ensure that the event dispatch loop is active

References fThread, HasError(), and ThreadEntryPoint().

Referenced by QTimer< T >::Start().

void * QTimerDispatcher::ThreadEntryPoint ( void *  ptr  )  [static, private]

utility method conforming to the interface requested by pthread

Parameters:
ptr pointer to this object

Referenced by AddTimer().


Member Data Documentation

pthread_t QTimerDispatcher::fThread [private]

handler for event dispatching thread

Referenced by AddTimer().

void* QTimerDispatcher::fEvBase [private]

thread safe event_base structure

Referenced by ExecuteThread(), and QTimerDispatcher().


The documentation for this class was generated from the following files:

Generated on Tue Nov 16 10:50:08 2010 for CUORE Software by  doxygen 1.5.6