aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ipc/IpcLogOutputter.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2019-10-05 21:10:12 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2019-10-05 21:10:12 -0400
commit78fb19eb26c8814cc83c649a252b7f47bdf649a0 (patch)
treee8f38f35e404b37d4683604cb2a826ff3f4d2f1d /src/lib/ipc/IpcLogOutputter.cpp
parent226b07c35afedc28ad1a769d6bf539e6cab320d4 (diff)
parentdff8b887edf10407f22aaab9d147948cd5491f0a (diff)
Update upstream source from tag 'upstream/2.3.2+dfsg'
Update to upstream version '2.3.2+dfsg' with Debian dir da6cb58f0203c792df99a475344204697ce64812
Diffstat (limited to 'src/lib/ipc/IpcLogOutputter.cpp')
-rw-r--r--src/lib/ipc/IpcLogOutputter.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/lib/ipc/IpcLogOutputter.cpp b/src/lib/ipc/IpcLogOutputter.cpp
index 984793e..b62c76a 100644
--- a/src/lib/ipc/IpcLogOutputter.cpp
+++ b/src/lib/ipc/IpcLogOutputter.cpp
@@ -39,7 +39,6 @@ enum EIpcLogOutputter {
IpcLogOutputter::IpcLogOutputter(IpcServer& ipcServer, EIpcClientType clientType, bool useThread) :
m_ipcServer(ipcServer),
- m_bufferMutex(ARCH->newMutex()),
m_sending(false),
m_bufferThread(nullptr),
m_running(false),
@@ -52,8 +51,7 @@ IpcLogOutputter::IpcLogOutputter(IpcServer& ipcServer, EIpcClientType clientType
m_bufferRateTimeLimit(kBufferRateTimeLimit),
m_bufferWriteCount(0),
m_bufferRateStart(ARCH->time()),
- m_clientType(clientType),
- m_runningMutex(ARCH->newMutex())
+ m_clientType(clientType)
{
if (useThread) {
m_bufferThread = new Thread(new TMethodJob<IpcLogOutputter>(
@@ -65,8 +63,6 @@ IpcLogOutputter::~IpcLogOutputter()
{
close();
- ARCH->closeMutex(m_bufferMutex);
-
if (m_bufferThread != nullptr) {
m_bufferThread->cancel();
m_bufferThread->wait();
@@ -86,7 +82,7 @@ void
IpcLogOutputter::close()
{
if (m_bufferThread != nullptr) {
- ArchMutexLock lock(m_runningMutex);
+ std::lock_guard<std::mutex> lock(m_runningMutex);
m_running = false;
notifyBuffer();
m_bufferThread->wait(5);
@@ -116,7 +112,7 @@ IpcLogOutputter::write(ELevel, const char* text)
void
IpcLogOutputter::appendBuffer(const String& text)
{
- ArchMutexLock lock(m_bufferMutex);
+ std::lock_guard<std::mutex> lock(m_bufferMutex);
double elapsed = ARCH->time() - m_bufferRateStart;
if (elapsed < m_bufferRateTimeLimit) {
@@ -143,7 +139,7 @@ IpcLogOutputter::appendBuffer(const String& text)
bool
IpcLogOutputter::isRunning()
{
- ArchMutexLock lock(m_runningMutex);
+ std::lock_guard<std::mutex> lock(m_runningMutex);
return m_running;
}
@@ -180,7 +176,7 @@ IpcLogOutputter::notifyBuffer()
String
IpcLogOutputter::getChunk(size_t count)
{
- ArchMutexLock lock(m_bufferMutex);
+ std::lock_guard<std::mutex> lock(m_bufferMutex);
if (m_buffer.size() < count) {
count = m_buffer.size();