forked from lix-project/lix
libstore: make Worker::wakeUp private
Change-Id: Iffa55272fe6ef4adaf3e9d4d25e5339792c2e460
This commit is contained in:
parent
3ecb46e3e7
commit
4c3010a1be
|
@ -648,8 +648,7 @@ Goal::WorkResult DerivationGoal::inputsRealised()
|
||||||
slot to become available, since we don't need one if there is a
|
slot to become available, since we don't need one if there is a
|
||||||
build hook. */
|
build hook. */
|
||||||
state = &DerivationGoal::tryToBuild;
|
state = &DerivationGoal::tryToBuild;
|
||||||
worker.wakeUp(shared_from_this());
|
return ContinueImmediately{};
|
||||||
return StillAlive{};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Goal::WorkResult DerivationGoal::started()
|
Goal::WorkResult DerivationGoal::started()
|
||||||
|
@ -763,8 +762,7 @@ Goal::WorkResult DerivationGoal::tryToBuild()
|
||||||
actLock.reset();
|
actLock.reset();
|
||||||
|
|
||||||
state = &DerivationGoal::tryLocalBuild;
|
state = &DerivationGoal::tryLocalBuild;
|
||||||
worker.wakeUp(shared_from_this());
|
return ContinueImmediately{};
|
||||||
return StillAlive{};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Goal::WorkResult DerivationGoal::tryLocalBuild() {
|
Goal::WorkResult DerivationGoal::tryLocalBuild() {
|
||||||
|
|
|
@ -108,12 +108,14 @@ public:
|
||||||
struct [[nodiscard]] StillAlive {};
|
struct [[nodiscard]] StillAlive {};
|
||||||
struct [[nodiscard]] WaitForSlot {};
|
struct [[nodiscard]] WaitForSlot {};
|
||||||
struct [[nodiscard]] WaitForAWhile {};
|
struct [[nodiscard]] WaitForAWhile {};
|
||||||
|
struct [[nodiscard]] ContinueImmediately {};
|
||||||
struct [[nodiscard]] Finished {
|
struct [[nodiscard]] Finished {
|
||||||
ExitCode result;
|
ExitCode result;
|
||||||
std::unique_ptr<Error> ex;
|
std::unique_ptr<Error> ex;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct [[nodiscard]] WorkResult : std::variant<StillAlive, WaitForSlot, WaitForAWhile, Finished>
|
struct [[nodiscard]] WorkResult
|
||||||
|
: std::variant<StillAlive, WaitForSlot, WaitForAWhile, ContinueImmediately, Finished>
|
||||||
{
|
{
|
||||||
WorkResult() = delete;
|
WorkResult() = delete;
|
||||||
using variant::variant;
|
using variant::variant;
|
||||||
|
|
|
@ -181,8 +181,7 @@ Goal::WorkResult PathSubstitutionGoal::referencesValid()
|
||||||
assert(worker.store.isValidPath(i));
|
assert(worker.store.isValidPath(i));
|
||||||
|
|
||||||
state = &PathSubstitutionGoal::tryToRun;
|
state = &PathSubstitutionGoal::tryToRun;
|
||||||
worker.wakeUp(shared_from_this());
|
return ContinueImmediately{};
|
||||||
return StillAlive{};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -255,8 +254,7 @@ Goal::WorkResult PathSubstitutionGoal::finished()
|
||||||
|
|
||||||
/* Try the next substitute. */
|
/* Try the next substitute. */
|
||||||
state = &PathSubstitutionGoal::tryNext;
|
state = &PathSubstitutionGoal::tryNext;
|
||||||
worker.wakeUp(shared_from_this());
|
return ContinueImmediately{};
|
||||||
return StillAlive{};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
worker.markContentsGood(storePath);
|
worker.markContentsGood(storePath);
|
||||||
|
|
|
@ -189,6 +189,7 @@ void Worker::handleWorkResult(GoalPtr goal, Goal::WorkResult how)
|
||||||
[&](Goal::StillAlive) {},
|
[&](Goal::StillAlive) {},
|
||||||
[&](Goal::WaitForSlot) { waitForBuildSlot(goal); },
|
[&](Goal::WaitForSlot) { waitForBuildSlot(goal); },
|
||||||
[&](Goal::WaitForAWhile) { waitForAWhile(goal); },
|
[&](Goal::WaitForAWhile) { waitForAWhile(goal); },
|
||||||
|
[&](Goal::ContinueImmediately) { wakeUp(goal); },
|
||||||
[&](Goal::Finished & f) { goalFinished(goal, f); },
|
[&](Goal::Finished & f) { goalFinished(goal, f); },
|
||||||
},
|
},
|
||||||
how
|
how
|
||||||
|
@ -523,7 +524,7 @@ void Worker::waitForInput()
|
||||||
if (rd == 0 || (rd == -1 && errno == EIO)) {
|
if (rd == 0 || (rd == -1 && errno == EIO)) {
|
||||||
debug("%1%: got EOF", goal->getName());
|
debug("%1%: got EOF", goal->getName());
|
||||||
goal->handleEOF(k);
|
goal->handleEOF(k);
|
||||||
wakeUp(goal);
|
handleWorkResult(goal, Goal::ContinueImmediately{});
|
||||||
j->fds.erase(k);
|
j->fds.erase(k);
|
||||||
} else if (rd == -1) {
|
} else if (rd == -1) {
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
|
|
|
@ -122,6 +122,11 @@ private:
|
||||||
*/
|
*/
|
||||||
void waitForAWhile(GoalPtr goal);
|
void waitForAWhile(GoalPtr goal);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wake up a goal (i.e., there is something for it to do).
|
||||||
|
*/
|
||||||
|
void wakeUp(GoalPtr goal);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
const Activity act;
|
const Activity act;
|
||||||
|
@ -219,11 +224,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void removeGoal(GoalPtr goal);
|
void removeGoal(GoalPtr goal);
|
||||||
|
|
||||||
/**
|
|
||||||
* Wake up a goal (i.e., there is something for it to do).
|
|
||||||
*/
|
|
||||||
void wakeUp(GoalPtr goal);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of local build processes currently running (but not
|
* Return the number of local build processes currently running (but not
|
||||||
* remote builds via the build hook).
|
* remote builds via the build hook).
|
||||||
|
|
Loading…
Reference in a new issue