neutrino: wait for timerd to avoid race on startup

Origin commit data
------------------
Branch: ni/coolstream
Commit: 84609f22ab
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-11-03 (Sat, 03 Nov 2012)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2012-11-03 21:26:35 +01:00
parent 2411d34db8
commit f92dbbf5b6
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");