It just makes things unnecessarily complicated. We can just exit without cleaning anything up, since the only thing to do is unmark builds and build steps as busy. But we can do that by having systemd call "hydra-queue-runner –unlock" from ExecStopPost.
C6HOMHZWMSC7ORGFUF5YG2ACKV2SCP26HL3UH6VXH6RNDYRXH5DAC
5AIYUMTBY6TFQTBRP3MJ2PYWUMRF57I77NIVWYE74UMEVQMBWZVQC
ENXUSMSVOU3AZFMH2ZXR4ZVPV2LRRQYQJ6IFX33YN6IH2ORSNSAAC
24BMQDZAWDQ7VNIA7TIROXSOYLOJBNZ2E4264WHWNJAEN6ZB3UOAC
NJJ7H64SZOX5EGACDCQAUQ7R6UEWD5IIC35A2MWFOOJV55DJYPHAC
T2EIYJNGPIANHKJ4HBJIPTINWKG7RDLHR3PVHFYAPPLHZAJQBVWAC
YZAI5GQU3HNMK5MEGF2Y7WS445AN4YKD3HNJQVQP545ODN3F5DLAC
}
std::mutex exitRequestMutex;
std::condition_variable exitRequest;
std::atomic<bool> exitRequested(false);
static std::atomic_int _int(0);
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();
/* Wait for SIGINT. */
{
std::unique_lock<std::mutex> lock(exitRequestMutex);
while (!exitRequested)
exitRequest.wait(lock);
}
printMsg(lvlError, "exiting...");
/* Shut down the various threads. */
{ std::lock_guard<std::mutex> lock(queueMonitorMutex); } // barrier
queueMonitorWakeup.notify_all();