hydra-queue-runner: Handle exceptions in the dispatcher thread

E.g. "resource unavailable" when creating new threads.
This commit is contained in:
Eelco Dolstra 2016-11-08 11:25:43 +01:00
parent 7863d2e1da
commit de9d7bcf25

View file

@ -32,6 +32,8 @@ void State::makeRunnable(Step::ptr step)
void State::dispatcher() void State::dispatcher()
{ {
while (true) { while (true) {
try {
printMsg(lvlDebug, "dispatcher woken up"); printMsg(lvlDebug, "dispatcher woken up");
nrDispatcherWakeups++; nrDispatcherWakeups++;
@ -54,6 +56,12 @@ void State::dispatcher()
} }
*dispatcherWakeup_ = false; *dispatcherWakeup_ = false;
} }
} catch (std::exception & e) {
printMsg(lvlError, format("dispatcher: %1%") % e.what());
sleep(1);
}
} }
printMsg(lvlError, "dispatcher exits"); printMsg(lvlError, "dispatcher exits");