]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
memstore: fix wrong use of lock_guard 20914/head
authorShen-Ta Hsieh(BestSteve) <ibmibmibm.tw@gmail.com>
Thu, 15 Mar 2018 12:31:13 +0000 (20:31 +0800)
committerShen-Ta Hsieh <ibmibmibm.tw@gmail.com>
Thu, 15 Mar 2018 12:36:48 +0000 (20:36 +0800)
std::lock_guard need a name to make RAII works properly
Signed-off-by: Shen-Ta Hsieh <ibmibmibm.tw@gmail.com>
src/os/memstore/MemStore.cc

index 47ec85d296fa3d9d2326bdc538fad38f373cc4d3..8dc41a95f205a0ccef6a584a0ca1acd70c53d972 100644 (file)
@@ -566,35 +566,35 @@ public:
     : c(c), o(o), it(o->omap.begin()) {}
 
   int seek_to_first() override {
-    std::lock_guard<std::mutex>(o->omap_mutex);
+    std::lock_guard<std::mutex> lock(o->omap_mutex);
     it = o->omap.begin();
     return 0;
   }
   int upper_bound(const string &after) override {
-    std::lock_guard<std::mutex>(o->omap_mutex);
+    std::lock_guard<std::mutex> lock(o->omap_mutex);
     it = o->omap.upper_bound(after);
     return 0;
   }
   int lower_bound(const string &to) override {
-    std::lock_guard<std::mutex>(o->omap_mutex);
+    std::lock_guard<std::mutex> lock(o->omap_mutex);
     it = o->omap.lower_bound(to);
     return 0;
   }
   bool valid() override {
-    std::lock_guard<std::mutex>(o->omap_mutex);
+    std::lock_guard<std::mutex> lock(o->omap_mutex);
     return it != o->omap.end();
   }
   int next(bool validate=true) override {
-    std::lock_guard<std::mutex>(o->omap_mutex);
+    std::lock_guard<std::mutex> lock(o->omap_mutex);
     ++it;
     return 0;
   }
   string key() override {
-    std::lock_guard<std::mutex>(o->omap_mutex);
+    std::lock_guard<std::mutex> lock(o->omap_mutex);
     return it->first;
   }
   bufferlist value() override {
-    std::lock_guard<std::mutex>(o->omap_mutex);
+    std::lock_guard<std::mutex> lock(o->omap_mutex);
     return it->second;
   }
   int status() override {