]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: use ceph::condition_variable in RGWReshardWait
authorCasey Bodley <cbodley@redhat.com>
Sat, 24 Nov 2018 03:33:05 +0000 (22:33 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 30 Nov 2018 19:37:03 +0000 (14:37 -0500)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_reshard.cc
src/rgw/rgw_reshard.h

index 955ee536d3c239c7138579ea488c07f96d5e09c9..9d8b94efefe5e938b4866a4dc5e2e932b493ab69 100644 (file)
@@ -863,13 +863,13 @@ int RGWReshard::clear_bucket_resharding(const string& bucket_instance_oid, cls_r
 }
 
 const int num_retries = 10;
-const int default_reshard_sleep_duration = 5;
+static const std::chrono::seconds default_reshard_sleep_duration(5);
 
 int RGWReshardWait::do_wait()
 {
-  Mutex::Locker l(lock);
+  std::unique_lock lock(mutex);
 
-  cond.WaitInterval(lock, utime_t(default_reshard_sleep_duration, 0));
+  cond.wait_for(lock, default_reshard_sleep_duration);
 
   if (going_down) {
     return -ECANCELED;
index e1ad4a9738e18707cd833fef9b3e7d2c30447230..bf113ff527acc6d6350a167dc03c58db1ddf068e 100644 (file)
@@ -170,11 +170,10 @@ public:
   void stop_processor();
 };
 
-
 class RGWReshardWait {
   RGWRados *store;
-  Mutex lock{"RGWReshardWait::lock"};
-  Cond cond;
+  ceph::mutex mutex = ceph::make_mutex("RGWReshardWait::lock");
+  ceph::condition_variable cond;
 
   bool going_down{false};
 
@@ -189,9 +188,9 @@ public:
                             const RGWBucketInfo& bucket_info);
 
   void stop() {
-    Mutex::Locker l(lock);
+    std::scoped_lock lock(mutex);
     going_down = true;
-    cond.SignalAll();
+    cond.notify_all();
   }
 };