From: Igor Fedotov Date: Sun, 8 Sep 2019 22:15:50 +0000 (+0300) Subject: common/work_queue: make ThreadPool/WorkQueue more reusable. X-Git-Tag: v14.2.5~17^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cef4e41bf29ce51e3b86c899b3acc970046a3b73;p=ceph.git common/work_queue: make ThreadPool/WorkQueue more reusable. Some tricks to be able to derive from ThreadPool. Signed-off-by: Igor Fedotov (cherry picked from commit e72801074c9d464044be3e981728c99618797984) --- diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index a978a6d6984..2ccdd9a1036 100644 --- a/src/common/WorkQueue.h +++ b/src/common/WorkQueue.h @@ -41,6 +41,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; @@ -69,7 +70,7 @@ public: void reset_tp_timeout(); void suspend_tp_timeout(); }; -private: +protected: /// Basic interface to a work queue used by the worker threads. struct WorkQueue_ { @@ -450,7 +451,7 @@ public: std::list m_items; uint32_t m_processing; }; -private: +protected: std::vector work_queues; int next_work_queue = 0; @@ -472,7 +473,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);