From 4c4a9b168fbc8d51434e048eb75c27b13cb5ed1f Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 29 Oct 2012 16:20:19 -0700 Subject: [PATCH] Cleanups. --- src/JobQueue.cpp | 8 ++++++++ src/JobQueue.h | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/JobQueue.cpp b/src/JobQueue.cpp index 40ab89483..7cf6456b0 100644 --- a/src/JobQueue.cpp +++ b/src/JobQueue.cpp @@ -70,6 +70,14 @@ void JobQueue::addJob(JobType type, const boost::function& jobFunc) } int JobQueue::getJobCount(JobType t) +{ + boost::mutex::scoped_lock sl(mJobLock); + + std::map::iterator c = mJobCounts.find(t); + return (c == mJobCounts.end()) ? 0 : c->second; +} + +int JobQueue::getJobCountGE(JobType t) { // return the number of jobs at this priority level or greater int ret = 0; diff --git a/src/JobQueue.h b/src/JobQueue.h index 48211cfb4..866b149d4 100644 --- a/src/JobQueue.h +++ b/src/JobQueue.h @@ -70,7 +70,8 @@ public: void addJob(JobType type, const boost::function& job); - int getJobCount(JobType t); // All jobs at or greater than this priority + int getJobCount(JobType t); // Jobs at this priority + int getJobCountGE(JobType t); // All jobs at or greater than this priority std::vector< std::pair > getJobCounts(); void shutdown();