neutrino: wait for timerd to avoid race on startup

This commit is contained in:
Stefan Seyfried
2012-11-03 21:26:35 +01:00
parent fa9f7f92ec
commit 84609f22ab
2 changed files with 16 additions and 7 deletions

View File

@@ -469,12 +469,16 @@ int timerd_main_thread(void *data)
CBasicServer timerd_server;
if (!timerd_server.prepare(TIMERD_UDS_NAME))
if (!timerd_server.prepare(TIMERD_UDS_NAME)) {
*(long *)data = -2; /* signal neutrino that waiting is pointless */
return -1;
}
// Start timer thread
CTimerManager::getInstance();
CTimerManager::getInstance()->wakeup =(bool)data;
CTimerManager::getInstance()->wakeup = !!(*(long *)data);
*(long *)data = -1; /* signal we're up and running */
timerd_server.run(timerd_parse_command, CTimerdMsg::ACTVERSION);
printf("timerd shutdown complete\n");