mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-08 14:41:57 +08:00
Checkpointing centralized event queue stuff. Currently have:
an event queue and events, TCP sockets converted to use events, unix multithreading and network stuff converted, and an X Windows event queue subclass.
This commit is contained in:
@@ -54,16 +54,6 @@ static const int g_prioritySuffixLength = 2;
|
||||
static const int g_priorityPad = g_maxPriorityLength +
|
||||
g_prioritySuffixLength;
|
||||
|
||||
//! Convenience object to lock/unlock a mutex
|
||||
class CLogLock {
|
||||
public:
|
||||
CLogLock(CArchMutex mutex) : m_mutex(mutex) { ARCH->lockMutex(m_mutex); }
|
||||
~CLogLock() { ARCH->unlockMutex(m_mutex); }
|
||||
|
||||
private:
|
||||
CArchMutex m_mutex;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// CLog
|
||||
@@ -198,7 +188,7 @@ CLog::insert(ILogOutputter* outputter, bool alwaysAtHead)
|
||||
assert(outputter != NULL);
|
||||
assert(outputter->getNewline() != NULL);
|
||||
|
||||
CLogLock lock(m_mutex);
|
||||
CArchMutexLock lock(m_mutex);
|
||||
if (alwaysAtHead) {
|
||||
m_alwaysOutputters.push_front(outputter);
|
||||
}
|
||||
@@ -214,7 +204,7 @@ CLog::insert(ILogOutputter* outputter, bool alwaysAtHead)
|
||||
void
|
||||
CLog::remove(ILogOutputter* outputter)
|
||||
{
|
||||
CLogLock lock(m_mutex);
|
||||
CArchMutexLock lock(m_mutex);
|
||||
m_outputters.remove(outputter);
|
||||
m_alwaysOutputters.remove(outputter);
|
||||
}
|
||||
@@ -222,7 +212,7 @@ CLog::remove(ILogOutputter* outputter)
|
||||
void
|
||||
CLog::pop_front(bool alwaysAtHead)
|
||||
{
|
||||
CLogLock lock(m_mutex);
|
||||
CArchMutexLock lock(m_mutex);
|
||||
COutputterList* list = alwaysAtHead ? &m_alwaysOutputters : &m_outputters;
|
||||
if (!list->empty()) {
|
||||
delete list->front();
|
||||
@@ -248,14 +238,14 @@ CLog::setFilter(const char* maxPriority)
|
||||
void
|
||||
CLog::setFilter(int maxPriority)
|
||||
{
|
||||
CLogLock lock(m_mutex);
|
||||
CArchMutexLock lock(m_mutex);
|
||||
m_maxPriority = maxPriority;
|
||||
}
|
||||
|
||||
int
|
||||
CLog::getFilter() const
|
||||
{
|
||||
CLogLock lock(m_mutex);
|
||||
CArchMutexLock lock(m_mutex);
|
||||
return m_maxPriority;
|
||||
}
|
||||
|
||||
@@ -276,7 +266,7 @@ CLog::output(int priority, char* msg) const
|
||||
}
|
||||
|
||||
// write to each outputter
|
||||
CLogLock lock(m_mutex);
|
||||
CArchMutexLock lock(m_mutex);
|
||||
for (COutputterList::const_iterator index = m_alwaysOutputters.begin();
|
||||
index != m_alwaysOutputters.end();
|
||||
++index) {
|
||||
|
||||
Reference in New Issue
Block a user