mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user