forked from lix-project/lix
Fix tests on systems with a non-master git defaultBranch #1
3 changed files with 3 additions and 17 deletions
|
@ -21,7 +21,6 @@ class Worker;
|
||||||
* A pointer to a goal.
|
* A pointer to a goal.
|
||||||
*/
|
*/
|
||||||
typedef std::shared_ptr<Goal> GoalPtr;
|
typedef std::shared_ptr<Goal> GoalPtr;
|
||||||
typedef std::weak_ptr<Goal> WeakGoalPtr;
|
|
||||||
|
|
||||||
struct CompareGoalPtrs {
|
struct CompareGoalPtrs {
|
||||||
bool operator() (const GoalPtr & a, const GoalPtr & b) const;
|
bool operator() (const GoalPtr & a, const GoalPtr & b) const;
|
||||||
|
@ -31,12 +30,6 @@ struct CompareGoalPtrs {
|
||||||
* Set of goals.
|
* Set of goals.
|
||||||
*/
|
*/
|
||||||
typedef std::set<GoalPtr, CompareGoalPtrs> Goals;
|
typedef std::set<GoalPtr, CompareGoalPtrs> Goals;
|
||||||
typedef std::set<WeakGoalPtr, std::owner_less<WeakGoalPtr>> WeakGoals;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A map of paths to goals (and the other way around).
|
|
||||||
*/
|
|
||||||
typedef std::map<StorePath, WeakGoalPtr> WeakGoalMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used as a hint to the worker on how to schedule a particular goal. For example,
|
* Used as a hint to the worker on how to schedule a particular goal. For example,
|
||||||
|
|
|
@ -44,6 +44,7 @@ Worker::~Worker()
|
||||||
are in trouble, since goals may call childTerminated() etc. in
|
are in trouble, since goals may call childTerminated() etc. in
|
||||||
their destructors). */
|
their destructors). */
|
||||||
topGoals.clear();
|
topGoals.clear();
|
||||||
|
awake.clear();
|
||||||
children.clear();
|
children.clear();
|
||||||
|
|
||||||
assert(expectedSubstitutions == 0);
|
assert(expectedSubstitutions == 0);
|
||||||
|
@ -310,12 +311,7 @@ std::vector<GoalPtr> Worker::run(std::function<Targets (GoalFactory &)> req)
|
||||||
/* Call every wake goal (in the ordering established by
|
/* Call every wake goal (in the ordering established by
|
||||||
CompareGoalPtrs). */
|
CompareGoalPtrs). */
|
||||||
while (!awake.empty() && !topGoals.empty()) {
|
while (!awake.empty() && !topGoals.empty()) {
|
||||||
Goals awake2;
|
Goals awake2 = std::move(awake);
|
||||||
for (auto & i : awake) {
|
|
||||||
GoalPtr goal = i.lock();
|
|
||||||
if (goal) awake2.insert(goal);
|
|
||||||
}
|
|
||||||
awake.clear();
|
|
||||||
for (auto & goal : awake2) {
|
for (auto & goal : awake2) {
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
auto result = goal->work();
|
auto result = goal->work();
|
||||||
|
|
|
@ -84,9 +84,6 @@ private:
|
||||||
|
|
||||||
bool running = false;
|
bool running = false;
|
||||||
|
|
||||||
/* Note: the worker should only have strong pointers to the
|
|
||||||
top-level goals. */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The top-level goals of the worker.
|
* The top-level goals of the worker.
|
||||||
*/
|
*/
|
||||||
|
@ -95,7 +92,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* Goals that are ready to do some work.
|
* Goals that are ready to do some work.
|
||||||
*/
|
*/
|
||||||
WeakGoals awake;
|
Goals awake;
|
||||||
|
|
||||||
template<typename G>
|
template<typename G>
|
||||||
struct CachedGoal
|
struct CachedGoal
|
||||||
|
|
Loading…
Reference in a new issue