diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-10-30 12:36:11 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-10-30 12:36:11 +0000 |
commit | 80f36eefc33a84b53d6748101fe6f7b75f440ce6 (patch) | |
tree | 18210a6a4bb6c054a67c472dfcdebc953981145a /fastos | |
parent | 1db555a020b946eb9d380ef0a74960265267ec48 (diff) |
Use std::mutex instead of FastOS_Mutex to protect ipc exit flag.
Diffstat (limited to 'fastos')
-rw-r--r-- | fastos/src/vespa/fastos/unix_ipc.cpp | 12 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/unix_ipc.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/fastos/src/vespa/fastos/unix_ipc.cpp b/fastos/src/vespa/fastos/unix_ipc.cpp index e968f0a3509..b6a28515a5d 100644 --- a/fastos/src/vespa/fastos/unix_ipc.cpp +++ b/fastos/src/vespa/fastos/unix_ipc.cpp @@ -492,10 +492,11 @@ Run(FastOS_ThreadInterface *thisThread, void *arg) BuildPollArray(&fds, &nfds, &allocnfds); } - - _lock.Lock(); - bool exitFlag(_exitFlag); - _lock.Unlock(); + bool exitFlag = false; + { + std::lock_guard<std::mutex> guard(_lock); + exitFlag = _exitFlag; + } if (exitFlag) { if (_appParentIPCDescriptor._fd != -1) @@ -609,10 +610,9 @@ void FastOS_UNIX_IPCHelper::NotifyProcessListChange () void FastOS_UNIX_IPCHelper::Exit () { - _lock.Lock(); + std::lock_guard<std::mutex> guard(_lock); _exitFlag = true; NotifyProcessListChange(); - _lock.Unlock(); } void FastOS_UNIX_IPCHelper::AddProcess (FastOS_UNIX_Process *xproc) diff --git a/fastos/src/vespa/fastos/unix_ipc.h b/fastos/src/vespa/fastos/unix_ipc.h index 35e77e11cb2..218096e2145 100644 --- a/fastos/src/vespa/fastos/unix_ipc.h +++ b/fastos/src/vespa/fastos/unix_ipc.h @@ -13,7 +13,7 @@ private: FastOS_UNIX_IPCHelper& operator=(const FastOS_UNIX_IPCHelper&); protected: - FastOS_Mutex _lock; + std::mutex _lock; volatile bool _exitFlag; FastOS_ApplicationInterface *_app; |