DBLoggerThread Class Reference

Thread that manages the queueing of logging inserts for the database. More...

#include <logging.h>

Inheritance diagram for DBLoggerThread:
MThread

List of all members.

Public Member Functions

 DBLoggerThread (DatabaseLogger *logger)
 DBLoggerThread constructor.
 ~DBLoggerThread ()
 DBLoggerThread deconstructor.
void run (void)
 Start the thread.
void stop (void)
 Tell the thread to stop by setting the aborted flag.
bool enqueue (LoggingItem *item)
 Enqueues a LoggingItem onto the queue for the thread to consume.
bool queueFull (void)
 Indicates when the queue is full.

Private Attributes

DatabaseLoggerm_logger
 The associated logger instance.
QMutex m_queueMutex
 Mutex for protecting the queue.
QQueue< LoggingItem * > * m_queue
 Queue of LoggingItems to insert.
QWaitCondition * m_wait
 Wait condition used for waiting for the queue to not be full.
volatile bool aborted
 Used during shutdown to indicate that the thread should stop ASAP.

Detailed Description

Thread that manages the queueing of logging inserts for the database.

The database logging gets throttled if it gets overwhelmed, and also during startup. Having a second queue allows the rest of the logging to remain in sync and to allow for burstiness in the database due to things like scheduler runs.

Definition at line 143 of file libmythbase/logging.h.


Constructor & Destructor Documentation

DBLoggerThread::DBLoggerThread ( DatabaseLogger logger  ) 

DBLoggerThread constructor.

Parameters:
logger DatabaseLogger instance that this thread belongs to

Definition at line 595 of file logging.cpp.

DBLoggerThread::~DBLoggerThread (  ) 

DBLoggerThread deconstructor.

Waits for the thread to finish, then Empties what remains in the queue before deleting it.

Definition at line 605 of file logging.cpp.


Member Function Documentation

void DBLoggerThread::run ( void   )  [virtual]

Start the thread.

Reimplemented from MThread.

Definition at line 620 of file logging.cpp.

void DBLoggerThread::stop ( void   ) 

Tell the thread to stop by setting the aborted flag.

Definition at line 689 of file logging.cpp.

Referenced by DatabaseLogger::stopDatabaseAccess(), and ~DBLoggerThread().

bool DBLoggerThread::enqueue ( LoggingItem item  )  [inline]

Enqueues a LoggingItem onto the queue for the thread to consume.

Definition at line 152 of file libmythbase/logging.h.

Referenced by DatabaseLogger::logmsg().

bool DBLoggerThread::queueFull ( void   )  [inline]

Indicates when the queue is full.

Returns:
true when the queue is full

Definition at line 162 of file libmythbase/logging.h.

Referenced by DatabaseLogger::logmsg().


Member Data Documentation

The associated logger instance.

Definition at line 168 of file libmythbase/logging.h.

Referenced by run().

QMutex DBLoggerThread::m_queueMutex [private]

Mutex for protecting the queue.

Definition at line 169 of file libmythbase/logging.h.

Referenced by enqueue(), queueFull(), run(), stop(), and ~DBLoggerThread().

QQueue<LoggingItem *>* DBLoggerThread::m_queue [private]

Queue of LoggingItems to insert.

Definition at line 170 of file libmythbase/logging.h.

Referenced by enqueue(), queueFull(), run(), and ~DBLoggerThread().

QWaitCondition* DBLoggerThread::m_wait [private]

Wait condition used for waiting for the queue to not be full.

Protected by m_queueMutex

Definition at line 171 of file libmythbase/logging.h.

Referenced by run(), stop(), and ~DBLoggerThread().

volatile bool DBLoggerThread::aborted [private]

Used during shutdown to indicate that the thread should stop ASAP.

Protected by m_queueMutex

Definition at line 174 of file libmythbase/logging.h.

Referenced by enqueue(), run(), and stop().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Generated on Thu May 24 06:41:57 2012 for MythTV by  doxygen 1.6.3