]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
dmclock/src/dmclock_server: move PriorityQueueBase::finishing into PushPriorityQueue
authorSamuel Just <sjust@redhat.com>
Fri, 8 Aug 2025 22:58:27 +0000 (15:58 -0700)
committerSamuel Just <sjust@redhat.com>
Fri, 5 Sep 2025 21:47:42 +0000 (14:47 -0700)
PriorityQueueBase::finishing is only used in PushPriorityQueue -- move there.

Also, it wasn't actually necessary for finishing to be an atomic as long
as ~PushPriorityQueue takes the lock before mutating it.  The readers
already hold the lock.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/dmclock/src/dmclock_server.h

index f27632bf34d2dd5f6eaa145bcb05e4159464680f..a8a168af2ca8969bfebdab80b7cfbca8e5c530f8 100644 (file)
@@ -806,11 +806,7 @@ namespace crimson {
       RejectThreshold  reject_threshold = 0;
 
       double           anticipation_timeout;
-#ifdef WITH_CRIMSON
-      bool finishing;
-#else
-      std::atomic_bool finishing;
-#endif
+
       // every request creates a tick
       Counter tick = 0;
 
@@ -853,7 +849,6 @@ namespace crimson {
        at_limit(get_or_default(at_limit_param, AtLimit::Reject)),
        reject_threshold(get_or_default(at_limit_param, RejectThreshold{0})),
        anticipation_timeout(_anticipation_timeout),
-       finishing(false),
        idle_age(std::chrono::duration_cast<Duration>(_idle_age)),
        erase_age(std::chrono::duration_cast<Duration>(_erase_age)),
        check_time(std::chrono::duration_cast<Duration>(_check_time)),
@@ -869,12 +864,6 @@ namespace crimson {
                         std::bind(&PriorityQueueBase::do_clean, this)));
       }
 
-
-      ~PriorityQueueBase() {
-       finishing = true;
-      }
-
-
       inline const ClientInfo* get_cli_info(ClientRec& client) const {
        if (is_dynamic_cli_info_f) {
          client.info = client_info_f(client.client);
@@ -1534,6 +1523,7 @@ namespace crimson {
       CanHandleRequestFunc can_handle_f;
       HandleRequestFunc    handle_f;
       // for handling timed scheduling
+      bool finishing = false;
       std::mutex  sched_ahead_mtx;
       std::condition_variable sched_ahead_cv;
       Time sched_ahead_when = TimeZero;
@@ -1591,9 +1581,9 @@ namespace crimson {
 
 
       ~PushPriorityQueue() {
-       this->finishing = true;
        {
          std::lock_guard<std::mutex> l(sched_ahead_mtx);
+         finishing = true;
          sched_ahead_cv.notify_one();
        }
        sched_ahead_thd.join();