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 QError & | GetError () const |
get error | |
void | Cleanup () |
bool | ThreadDone () |
Static Public Member Functions | |
static QTimerDispatcher & | GetInstance () |
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 |
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
ptr | pointer to this object |
Referenced by AddTimer().
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().