A small change with big consequences. Allow job queue threads to moonlight as I/O threads.

This commit is contained in:
JoelKatz
2013-03-29 10:18:11 -07:00
parent 3b40a7787d
commit 9cbd019874
3 changed files with 40 additions and 5 deletions

View File

@@ -8,6 +8,7 @@
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/make_shared.hpp>
#include <boost/asio.hpp>
#include <boost/ref.hpp>
#include "../json/value.h"
@@ -93,14 +94,19 @@ protected:
int mThreadCount;
bool mShuttingDown;
int mIOThreadCount;
int mMaxIOThreadCount;
boost::asio::io_service& mIOService;
std::map<JobType, std::pair<int, int > > mJobCounts;
void threadEntry(void);
void threadEntry();
void IOThread(boost::mutex::scoped_lock&);
public:
JobQueue();
JobQueue(boost::asio::io_service&);
void addJob(JobType type, const std::string& name, const FUNCTION_TYPE<void(Job&)>& job);