libstore: remove addToWeakGoals
under owner_less it's equivalent to insert(), only sometimes a little bit faster because it does not construct a weak_ptr if the goal is in the set already. this small difference in performance does not matter here and c++23 will make insert transparent anyway, so we can drop it Change-Id: I7cbd7d6e0daa95d67145ec58183162f6c4743b15
This commit is contained in:
parent
d70e045f90
commit
ad36fb43ad
3 changed files with 4 additions and 14 deletions
|
@ -34,18 +34,10 @@ BuildResult Goal::getBuildResult(const DerivedPath & req) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void addToWeakGoals(WeakGoals & goals, GoalPtr p)
|
|
||||||
{
|
|
||||||
if (goals.find(p) != goals.end())
|
|
||||||
return;
|
|
||||||
goals.insert(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Goal::addWaitee(GoalPtr waitee)
|
void Goal::addWaitee(GoalPtr waitee)
|
||||||
{
|
{
|
||||||
waitees.insert(waitee);
|
waitees.insert(waitee);
|
||||||
addToWeakGoals(waitee->waiters, shared_from_this());
|
waitee->waiters.insert(shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,4 @@ public:
|
||||||
virtual JobCategory jobCategory() const = 0;
|
virtual JobCategory jobCategory() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
void addToWeakGoals(WeakGoals & goals, GoalPtr p);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,7 @@ void Worker::removeGoal(GoalPtr goal)
|
||||||
void Worker::wakeUp(GoalPtr goal)
|
void Worker::wakeUp(GoalPtr goal)
|
||||||
{
|
{
|
||||||
goal->trace("woken up");
|
goal->trace("woken up");
|
||||||
addToWeakGoals(awake, goal);
|
awake.insert(goal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -249,14 +249,14 @@ void Worker::waitForBuildSlot(GoalPtr goal)
|
||||||
(isSubstitutionGoal && getNrSubstitutions() < settings.maxSubstitutionJobs))
|
(isSubstitutionGoal && getNrSubstitutions() < settings.maxSubstitutionJobs))
|
||||||
wakeUp(goal); /* we can do it right away */
|
wakeUp(goal); /* we can do it right away */
|
||||||
else
|
else
|
||||||
addToWeakGoals(wantingToBuild, goal);
|
wantingToBuild.insert(goal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Worker::waitForAWhile(GoalPtr goal)
|
void Worker::waitForAWhile(GoalPtr goal)
|
||||||
{
|
{
|
||||||
debug("wait for a while");
|
debug("wait for a while");
|
||||||
addToWeakGoals(waitingForAWhile, goal);
|
waitingForAWhile.insert(goal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue