From 7c4ce371fde8c07c51c3429c2646c7a5ccfea8f3 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 16 Oct 2018 09:10:47 -0500 Subject: [PATCH] common/ceph_context: Mutex -> ceph::mutex Signed-off-by: Sage Weil --- src/common/ceph_context.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index 025799dc314d9..d5f4c02a4ff73 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -25,7 +25,8 @@ #include "include/mempool.h" #include "common/admin_socket.h" #include "common/code_environment.h" -#include "common/Cond.h" +#include "common/ceph_mutex.h" +#include "common/debug.h" #include "common/config.h" #include "common/ceph_crypto.h" #include "common/HeartbeatMap.h" @@ -174,8 +175,7 @@ class CephContextServiceThread : public Thread { public: explicit CephContextServiceThread(CephContext *cct) - : _lock("CephContextServiceThread::_lock"), - _reopen_logs(false), _exit_thread(false), _cct(cct) + : _reopen_logs(false), _exit_thread(false), _cct(cct) { } @@ -184,13 +184,13 @@ public: void *entry() override { while (1) { - std::lock_guard l(_lock); + std::unique_lock l(_lock); if (_cct->_conf->heartbeat_interval) { - utime_t interval(_cct->_conf->heartbeat_interval, 0); - _cond.WaitInterval(_lock, interval); + auto interval = ceph::make_timespan(_cct->_conf->heartbeat_interval); + _cond.wait_for(l, interval); } else - _cond.Wait(_lock); + _cond.wait(l); if (_exit_thread) { break; @@ -210,21 +210,21 @@ public: void reopen_logs() { - std::lock_guard l(_lock); + std::lock_guard l(_lock); _reopen_logs = true; - _cond.Signal(); + _cond.notify_all(); } void exit_thread() { - std::lock_guard l(_lock); + std::lock_guard l(_lock); _exit_thread = true; - _cond.Signal(); + _cond.notify_all(); } private: - Mutex _lock; - Cond _cond; + ceph::mutex _lock = ceph::make_mutex("CephContextServiceThread::_lock"); + ceph::condition_variable _cond; bool _reopen_logs; bool _exit_thread; CephContext *_cct; -- 2.39.5