aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ipc/IpcClientProxy.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/IpcClientProxy.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/IpcClientProxy.cpp')
-rw-r--r--src/lib/ipc/IpcClientProxy.cpp19
1 files changed, 7 insertions, 12 deletions
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<std::mutex> lock_read(m_readMutex);
+ std::lock_guard<std::mutex> 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<std::mutex> 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<std::mutex> lock(m_writeMutex);
LOG((CLOG_DEBUG4 "ipc write: %d", message.type()));