From: Casey Bodley Date: Sat, 24 Nov 2018 03:33:05 +0000 (-0500) Subject: rgw: use ceph::condition_variable in RGWReshardWait X-Git-Tag: v14.1.0~617^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=10a398c7ef6a3800b2c103fdbda224821242b804;p=ceph.git rgw: use ceph::condition_variable in RGWReshardWait Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_reshard.cc b/src/rgw/rgw_reshard.cc index 955ee536d3c..9d8b94efefe 100644 --- a/src/rgw/rgw_reshard.cc +++ b/src/rgw/rgw_reshard.cc @@ -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; diff --git a/src/rgw/rgw_reshard.h b/src/rgw/rgw_reshard.h index e1ad4a9738e..bf113ff527a 100644 --- a/src/rgw/rgw_reshard.h +++ b/src/rgw/rgw_reshard.h @@ -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(); } };