]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: improve the ability to mock PointerWQ classes
authorJason Dillaman <dillaman@redhat.com>
Thu, 22 Jun 2017 17:31:10 +0000 (13:31 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 27 Jun 2017 17:56:09 +0000 (13:56 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/common/WorkQueue.h
src/librbd/io/ImageRequestWQ.cc

index c817e74ec0920201ef88199ff42750b284823f17..d3eff47bdf844e61139a0de11df33d159c79a447 100644 (file)
@@ -373,6 +373,9 @@ public:
     PointerWQ(string n, time_t ti, time_t sti, ThreadPool* p)
       : WorkQueue_(std::move(n), ti, sti), m_pool(p), m_processing(0) {
     }
+    void register_work_queue() {
+      m_pool->add_work_queue(this);
+    }
     void _clear() override {
       assert(m_pool->_lock.is_locked());
       m_items.clear();
@@ -576,7 +579,7 @@ public:
   ContextWQ(const string &name, time_t ti, ThreadPool *tp)
     : ThreadPool::PointerWQ<Context>(name, ti, 0, tp),
       m_lock("ContextWQ::m_lock") {
-    tp->add_work_queue(this);
+    this->register_work_queue();
   }
 
   void queue(Context *ctx, int result = 0) {
index 8b59964e94c7652317e00bab9618f1cd2f5abff9..593301c5abcf7f8037a51a14d1b9af95164497df 100644 (file)
@@ -69,7 +69,7 @@ ImageRequestWQ<I>::ImageRequestWQ(I *image_ctx, const string &name,
     m_lock(util::unique_lock_name("ImageRequestWQ<I>::m_lock", this)) {
   CephContext *cct = m_image_ctx.cct;
   ldout(cct, 5) << "ictx=" << image_ctx << dendl;
-  tp->add_work_queue(this);
+  this->register_work_queue();
 }
 
 template <typename I>