]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/lru_map: Mutex -> ceph::mutex
authorSage Weil <sage@redhat.com>
Tue, 16 Oct 2018 14:28:30 +0000 (09:28 -0500)
committerKefu Chai <kchai@redhat.com>
Wed, 21 Nov 2018 03:56:32 +0000 (11:56 +0800)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/lru_map.h

index 3b0bb543f06dc72a3c9692e024d97ceb834a6e1f..4c1c2dadbf8c6dd49560110d0c4043998a6ece58 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef CEPH_LRU_MAP_H
 #define CEPH_LRU_MAP_H
 
-#include "common/Mutex.h"
+#include "common/ceph_mutex.h"
 
 template <class K, class V>
 class lru_map {
@@ -13,7 +13,7 @@ class lru_map {
   std::map<K, entry> entries;
   std::list<K> entries_lru;
 
-  Mutex lock;
+  ceph::mutex lock = ceph::make_mutex("lru_map::lock");
 
   size_t max;
 
@@ -30,7 +30,7 @@ public:
   void _add(const K& key, V& value);
 
 public:
-  lru_map(int _max) : lock("lru_map"), max(_max) {}
+  lru_map(int _max) : max(_max) {}
   virtual ~lru_map() {}
 
   bool find(const K& key, V& value);
@@ -74,14 +74,14 @@ bool lru_map<K, V>::_find(const K& key, V *value, UpdateContext *ctx)
 template <class K, class V>
 bool lru_map<K, V>::find(const K& key, V& value)
 {
-  std::lock_guard<Mutex> l(lock);
+  std::lock_guard l(lock);
   return _find(key, &value, NULL);
 }
 
 template <class K, class V>
 bool lru_map<K, V>::find_and_update(const K& key, V *value, UpdateContext *ctx)
 {
-  std::lock_guard<Mutex> l(lock);
+  std::lock_guard l(lock);
   return _find(key, value, ctx);
 }
 
@@ -112,14 +112,14 @@ void lru_map<K, V>::_add(const K& key, V& value)
 template <class K, class V>
 void lru_map<K, V>::add(const K& key, V& value)
 {
-  std::lock_guard<Mutex> l(lock);
+  std::lock_guard l(lock);
   _add(key, value);
 }
 
 template <class K, class V>
 void lru_map<K, V>::erase(const K& key)
 {
-  std::lock_guard<Mutex> l(lock);
+  std::lock_guard l(lock);
   typename std::map<K, entry>::iterator iter = entries.find(key);
   if (iter == entries.end())
     return;