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: v15.1.0~1544^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e72801074c9d464044be3e981728c99618797984;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 --- diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index 032048eedd4..c687f52c57a 100644 --- a/src/common/WorkQueue.h +++ b/src/common/WorkQueue.h @@ -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 m_items; uint32_t m_processing; }; -private: +protected: std::vector 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);