From dff8b887edf10407f22aaab9d147948cd5491f0a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 5 Oct 2019 21:10:01 -0400 Subject: New upstream version 2.3.2+dfsg --- src/lib/ipc/IpcClientProxy.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/lib/ipc/IpcClientProxy.cpp') diff --git a/src/lib/ipc/IpcClientProxy.cpp b/src/lib/ipc/IpcClientProxy.cpp index af85eca..5104277 100644 --- a/src/lib/ipc/IpcClientProxy.cpp +++ b/src/lib/ipc/IpcClientProxy.cpp @@ -34,8 +34,6 @@ IpcClientProxy::IpcClientProxy(barrier::IStream& stream, IEventQueue* events) : m_stream(stream), m_clientType(kIpcClientUnknown), m_disconnecting(false), - m_readMutex(ARCH->newMutex()), - m_writeMutex(ARCH->newMutex()), m_events(events) { m_events->adoptHandler( @@ -71,14 +69,11 @@ IpcClientProxy::~IpcClientProxy() m_events->forIStream().outputShutdown(), m_stream.getEventTarget()); // don't delete the stream while it's being used. - ARCH->lockMutex(m_readMutex); - ARCH->lockMutex(m_writeMutex); - delete &m_stream; - ARCH->unlockMutex(m_readMutex); - ARCH->unlockMutex(m_writeMutex); - - ARCH->closeMutex(m_readMutex); - ARCH->closeMutex(m_writeMutex); + { + std::lock_guard lock_read(m_readMutex); + std::lock_guard lock_write(m_writeMutex); + delete &m_stream; + } } void @@ -99,7 +94,7 @@ void IpcClientProxy::handleData(const Event&, void*) { // don't allow the dtor to destroy the stream while we're using it. - ArchMutexLock lock(m_readMutex); + std::lock_guard lock(m_readMutex); LOG((CLOG_DEBUG "start ipc handle data")); @@ -139,7 +134,7 @@ IpcClientProxy::send(const IpcMessage& message) // don't allow other threads to write until we've finished the entire // message. stream write is locked, but only for that single write. // also, don't allow the dtor to destroy the stream while we're using it. - ArchMutexLock lock(m_writeMutex); + std::lock_guard lock(m_writeMutex); LOG((CLOG_DEBUG4 "ipc write: %d", message.type())); -- cgit v1.2.3