Use SharedData in JobQueue and set latency, limits for new job types

This commit is contained in:
Vinnie Falco
2013-08-24 10:09:35 -07:00
parent 2bea9a8739
commit 21485ec003
2 changed files with 105 additions and 68 deletions

View File

@@ -68,26 +68,30 @@ public:
Json::Value getJson (int c = 0);
private:
typedef RippleMutex LockType;
typedef LockType::ScopedLockType ScopedLockType;
LockType mLock;
typedef std::set <Job> JobSet;
void queueJob (Job const& job, ScopedLockType&);
void getNextJob (Job& job, ScopedLockType&);
void finishJob (Job const& job);
struct State
{
State ();
uint64 lastJob;
JobSet jobSet;
JobCounts jobCounts;
};
typedef SharedData <State> SharedState;
void queueJob (Job const& job, SharedState::WriteAccess& state);
void getNextJob (Job& job, SharedState::WriteAccess& state);
void finishJob (Job const& job);
void processTask ();
static int getJobLimit (JobType type);
private:
SharedState m_state;
Workers m_workers;
uint64 mLastJob;
JobSet mJobSet;
LoadMonitor mJobLoads [NUM_JOB_TYPES];
JobCounts mJobCounts;
};
#endif