Revert "Made buffer thread wait until there is a GUI client #4721"

This reverts commit 9a4327e44236c0ac30809660dc87a97e984dc84f.
This commit is contained in:
Jerry (Xinyu Hou)
2015-07-15 11:57:33 -07:00
parent 01526bbe78
commit 5ec9ccc76e
4 changed files with 16 additions and 20 deletions

View File

@@ -37,7 +37,7 @@ enum EIpcLogOutputter {
kBufferRateTimeLimit = 1 // seconds
};
IpcLogOutputter::IpcLogOutputter(IpcServer& ipcServer, EIpcClientType clientType, bool useThread) :
IpcLogOutputter::IpcLogOutputter(IpcServer& ipcServer, bool useThread) :
m_ipcServer(ipcServer),
m_bufferMutex(ARCH->newMutex()),
m_sending(false),
@@ -50,8 +50,7 @@ IpcLogOutputter::IpcLogOutputter(IpcServer& ipcServer, EIpcClientType clientType
m_bufferRateWriteLimit(kBufferRateWriteLimit),
m_bufferRateTimeLimit(kBufferRateTimeLimit),
m_bufferWriteCount(0),
m_bufferRateStart(ARCH->time()),
m_clientType(clientType)
m_bufferRateStart(ARCH->time())
{
if (useThread) {
m_bufferThread = new Thread(new TMethodJob<IpcLogOutputter>(
@@ -103,9 +102,7 @@ IpcLogOutputter::write(ELevel, const char* text)
}
appendBuffer(text);
if (m_ipcServer.hasClients(m_clientType)) {
notifyBuffer();
}
notifyBuffer();
return true;
}
@@ -144,7 +141,7 @@ IpcLogOutputter::bufferThread(void*)
try {
while (m_running) {
if (m_buffer.empty() || !m_ipcServer.hasClients(m_clientType)) {
if (m_buffer.empty()) {
ArchMutexLock lock(m_notifyMutex);
ARCH->waitCondVar(m_notifyCond, m_notifyMutex, -1);
}
@@ -187,7 +184,7 @@ IpcLogOutputter::getChunk(size_t count)
void
IpcLogOutputter::sendBuffer()
{
if (m_buffer.empty() || !m_ipcServer.hasClients(m_clientType)) {
if (m_buffer.empty() || !m_ipcServer.hasClients(kIpcClientGui)) {
return;
}