NJJ7H64SZOX5EGACDCQAUQ7R6UEWD5IIC35A2MWFOOJV55DJYPHAC void sigintHandler(int signo){_int = 1;}void signalThread(){struct sigaction act;act.sa_handler = sigintHandler;sigemptyset(&act.sa_mask);act.sa_flags = 0;if (sigaction(SIGINT, &act, 0))throw SysError("installing handler for SIGINT");while (true) {sleep(1000000);if (_int) break;}{std::lock_guard<std::mutex> lock(exitRequestMutex);exitRequested = true;}exitRequest.notify_all();}
void State::getQueuedBuilds(pqxx::connection & conn)
void State::queueMonitorThreadEntry(){auto store = openStore(); // FIXME: poolConnection conn;while (true) {getQueuedBuilds(store, conn);{std::unique_lock<std::mutex> lock(exitRequestMutex);exitRequest.wait_for(lock, std::chrono::seconds(5));if (exitRequested) break;}}printMsg(lvlError, "queue monitor exits");}void State::getQueuedBuilds(std::shared_ptr<StoreAPI> store, pqxx::connection & conn)
while (!runnable.empty()) {printMsg(lvlInfo, format("%1% runnable steps") % runnable.size());Step::ptr step = *runnable.begin();runnable.erase(step);doBuildStep(step);
assert(step->deps.empty());{std::lock_guard<std::mutex> lock(runnableMutex);runnable.insert(step);
void State::doBuildStep(Step::ptr step)
void State::builderThreadEntry(int slot){auto store = openStore(); // FIXME: poolwhile (true) {Step::ptr step;{std::unique_lock<std::mutex> lock(runnableMutex);while (runnable.empty())runnableCV.wait(lock);step = *runnable.begin();runnable.erase(step);}printMsg(lvlError, format("slot %1%: got build step ‘%2%’") % slot % step->drvPath);doBuildStep(store, step);}printMsg(lvlError, "builder thread exits");}void State::doBuildStep(std::shared_ptr<StoreAPI> store, Step::ptr step)