Add a way for us to place jobs with a concurrency limit.

The main use case is having all threads stuck in ledgerData, fighting each other.
This commit is contained in:
JoelKatz
2013-07-13 19:02:35 -07:00
parent d9956845bb
commit ac452832bf
6 changed files with 76 additions and 20 deletions

View File

@@ -7,17 +7,20 @@
Job::Job ()
: mType (jtINVALID)
, mJobIndex (0)
, m_limit (0)
{
}
Job::Job (JobType type, uint64 index)
: mType (type)
, mJobIndex (index)
, m_limit (0)
{
}
Job::Job (JobType type,
std::string const& name,
int limit,
uint64 index,
LoadMonitor& lm,
FUNCTION_TYPE <void (Job&)> const& job)
@@ -25,6 +28,7 @@ Job::Job (JobType type,
, mJobIndex (index)
, mJob (job)
, mName (name)
, m_limit(limit)
{
m_loadEvent = boost::make_shared <LoadEvent> (boost::ref (lm), name, false);
}
@@ -52,6 +56,11 @@ void Job::rename (std::string const& newName)
mName = newName;
}
int Job::getLimit () const
{
return m_limit;
}
const char* Job::toString (JobType t)
{
switch (t)