Thread that manages the queueing of logging inserts for the database. More...
#include <logging.h>
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 | |
| DatabaseLogger * | m_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. | |
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.
| DBLoggerThread::DBLoggerThread | ( | DatabaseLogger * | logger | ) |
DBLoggerThread constructor.
| 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.
| void DBLoggerThread::run | ( | void | ) | [virtual] |
| 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.
Definition at line 162 of file libmythbase/logging.h.
Referenced by DatabaseLogger::logmsg().
DatabaseLogger* DBLoggerThread::m_logger [private] |
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.
1.6.3