|
MythTV
0.26-pre
|
The logging thread that consumes the logging queue and dispatches each LoggingItem to each logger instance. More...
#include <logging.h>
Public Member Functions | |
| LoggerThread () | |
| LoggerThread constructor. | |
| ~LoggerThread () | |
| LoggerThread destructor. Triggers the deletion of all loggers. | |
| void | run (void) |
| Run the logging thread. | |
| void | stop (void) |
| Stop the thread by setting the abort flag after waiting a second for the queue to be flushed. | |
| bool | flush (int timeoutMS=200000) |
| Wait for the queue to be flushed (up to a timeout) | |
| void | handleItem (LoggingItem *item) |
| Handles each LoggingItem, generally by handing it off to the various running logger instances. | |
Private Attributes | |
| QWaitCondition * | m_waitNotEmpty |
| Condition variable for waiting for the queue to not be empty Protected by logQueueMutex. | |
| QWaitCondition * | m_waitEmpty |
| Condition variable for waiting for the queue to be empty Protected by logQueueMutex. | |
| bool | aborted |
| Flag to abort the thread. | |
The logging thread that consumes the logging queue and dispatches each LoggingItem to each logger instance.
Definition at line 116 of file libmythbase/logging.h.
LoggerThread constructor.
Enables debugging of thread registration and deregistration if the VERBOSE_THREADS environment variable is set.
Definition at line 775 of file logging.cpp.
LoggerThread destructor. Triggers the deletion of all loggers.
Definition at line 791 of file logging.cpp.
| void LoggerThread::run | ( | void | ) | [virtual] |
Run the logging thread.
This thread reads from the logging queue, and handles distributing the LoggingItems to each logger instance. The thread will not exit until the logging queue is emptied completely, ensuring that all logging is flushed.
Reimplemented from MThread.
Definition at line 813 of file logging.cpp.
Stop the thread by setting the abort flag after waiting a second for the queue to be flushed.
Definition at line 914 of file logging.cpp.
Referenced by logStop(), and ~LoggerThread().
| bool LoggerThread::flush | ( | int | timeoutMS = 200000 | ) |
Wait for the queue to be flushed (up to a timeout)
| timeoutMS | The number of ms to wait for the queue to flush |
Definition at line 925 of file logging.cpp.
Referenced by LogPrintLine(), and stop().
| void LoggerThread::handleItem | ( | LoggingItem * | item | ) |
Handles each LoggingItem, generally by handing it off to the various running logger instances.
There is a special case for thread registration and deregistration which are also included in the logging queue to keep the thread names in sync with the log messages.
| item | The LoggingItem to be handled |
Definition at line 853 of file logging.cpp.
Referenced by LogPrintLine(), and run().
QWaitCondition* LoggerThread::m_waitNotEmpty [private] |
Condition variable for waiting for the queue to not be empty Protected by logQueueMutex.
Definition at line 126 of file libmythbase/logging.h.
Referenced by flush(), run(), stop(), and ~LoggerThread().
QWaitCondition* LoggerThread::m_waitEmpty [private] |
Condition variable for waiting for the queue to be empty Protected by logQueueMutex.
Definition at line 129 of file libmythbase/logging.h.
Referenced by flush(), run(), and ~LoggerThread().
bool LoggerThread::aborted [private] |
Flag to abort the thread.
Protected by logQueueMutex
Definition at line 132 of file libmythbase/logging.h.
1.7.6.1