From 60f4e0e4522940b7f0c42930160ae8fa22725576 Mon Sep 17 00:00:00 2001 From: Pan Liu Date: Tue, 25 Apr 2017 18:05:20 +0800 Subject: [PATCH] src/common: change last_work_queue to next_work_queue. Signed-off-by: Pan Liu --- src/common/WorkQueue.cc | 6 ++---- src/common/WorkQueue.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/common/WorkQueue.cc b/src/common/WorkQueue.cc index b74763901bfe3..ec5f8a1476d1f 100644 --- a/src/common/WorkQueue.cc +++ b/src/common/WorkQueue.cc @@ -39,7 +39,6 @@ ThreadPool::ThreadPool(CephContext *cct_, string nm, string tn, int n, const cha ioprio_class(-1), ioprio_priority(-1), _num_threads(n), - last_work_queue(0), processing(0) { if (option) { @@ -117,9 +116,8 @@ void ThreadPool::worker(WorkThread *wt) int tries = work_queues.size(); bool did = false; while (tries--) { - last_work_queue++; - last_work_queue %= work_queues.size(); - wq = work_queues[last_work_queue]; + next_work_queue %= work_queues.size(); + wq = work_queues[next_work_queue++]; void *item = wq->_void_dequeue(); if (item) { diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index d67d84ef7faee..6e29da6fd380b 100644 --- a/src/common/WorkQueue.h +++ b/src/common/WorkQueue.h @@ -434,7 +434,7 @@ public: }; private: vector work_queues; - int last_work_queue; + int next_work_queue = 0; // threads -- 2.39.5