]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/work_queue: make ThreadPool/WorkQueue more reusable.
authorIgor Fedotov <ifedotov@suse.com>
Sun, 8 Sep 2019 22:15:50 +0000 (01:15 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Wed, 11 Sep 2019 15:15:28 +0000 (18:15 +0300)
Some tricks to be able to derive from ThreadPool.

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/common/WorkQueue.h

index 032048eedd438b3b1be22ed913974916dba8d72b..c687f52c57a890125808ae2b47946462509cecc9 100644 (file)
@@ -42,6 +42,7 @@ class CephContext;
 
 /// Pool of threads that share work submitted to multiple work queues.
 class ThreadPool : public md_config_obs_t {
+protected:
   CephContext *cct;
   std::string name;
   std::string thread_name;
@@ -70,7 +71,7 @@ public:
     void reset_tp_timeout() override final;
     void suspend_tp_timeout() override final;
   };
-private:
+protected:
 
   /// Basic interface to a work queue used by the worker threads.
   struct WorkQueue_ {
@@ -451,7 +452,7 @@ public:
     std::list<T *> m_items;
     uint32_t m_processing;
   };
-private:
+protected:
   std::vector<WorkQueue_*> work_queues;
   int next_work_queue = 0;
  
@@ -473,7 +474,7 @@ private:
 
   void start_threads();
   void join_old_threads();
-  void worker(WorkThread *wt);
+  virtual void worker(WorkThread *wt);
 
 public:
   ThreadPool(CephContext *cct_, std::string nm, std::string tn, int n, const char *option = NULL);