Skip to content

Commit

Permalink
Merge pull request #14738 from liupan1111/wip-fix-initial
Browse files Browse the repository at this point in the history
src/common: change last_work_queue to next_work_queue. 

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
Reviewed-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
liewegas committed Apr 25, 2017
2 parents 4ba4567 + 60f4e0e commit 5af0944
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/common/WorkQueue.cc
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/common/WorkQueue.h
Expand Up @@ -434,7 +434,7 @@ class ThreadPool : public md_config_obs_t {
};
private:
vector<WorkQueue_*> work_queues;
int last_work_queue;
int next_work_queue = 0;


// threads
Expand Down

0 comments on commit 5af0944

Please sign in to comment.