diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 336dfa6ac..911e33a02 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -189,10 +189,9 @@ t_channel_id standby_channel_id = 0; //NEW static pthread_t timer_thread; -void * timerd_main_thread(void *data); static bool timerd_thread_started = false; - -void * nhttpd_main_thread(void *data); +extern void *timerd_main_thread(void *data); +extern void *nhttpd_main_thread(void *data); //#define DISABLE_SECTIONSD @@ -3143,8 +3142,9 @@ TIMER_START(); /* wait until timerd is ready... */ int64_t timerd_wait = time_monotonic_ms(); - while (timerd_signal >= 0) + while (timerd_signal >= 0) { usleep(100); + } dprintf(DEBUG_NORMAL, "had to wait %" PRId64 " ms for timerd start...\n", time_monotonic_ms() - timerd_wait); InitTimerdClient(); diff --git a/src/timerd/timerd.cpp b/src/timerd/timerd.cpp index 1df5850f1..b0fb9ae30 100644 --- a/src/timerd/timerd.cpp +++ b/src/timerd/timerd.cpp @@ -260,7 +260,7 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd) break; } - case CTimerdMsg::CMD_ADDTIMER: // neuen timer hinzufügen + case CTimerdMsg::CMD_ADDTIMER: // neuen timer hinzufuegen CTimerdMsg::commandAddTimer msgAddTimer; CBasicServer::receive_data(connfd,&msgAddTimer, sizeof(msgAddTimer)); @@ -438,7 +438,7 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd) CTimerManager::getInstance()->stopEvent(msgStopTimer.eventID); break; - case CTimerdMsg::CMD_TIMERDAVAILABLE: // testen ob server läuft ;) + case CTimerdMsg::CMD_TIMERDAVAILABLE: // testen ob server laeuft ;) { CTimerdMsg::responseAvailable rspAvailable; rspAvailable.available = true; @@ -481,7 +481,7 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd) return true; } -int timerd_main_thread(void *data) +void *timerd_main_thread(void *data) { pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0); set_threadname("n:timerd"); @@ -491,7 +491,8 @@ int timerd_main_thread(void *data) if (!timerd_server.prepare(TIMERD_UDS_NAME)) { *(long *)data = -2; /* signal neutrino that waiting is pointless */ - return -1; + fprintf(stderr, "Error: Failed to prepare timerd server with UDS name: %s\n", TIMERD_UDS_NAME); + return (void*)EXIT_FAILURE; // return as a `void*`-pointer } // Start timer thread @@ -502,5 +503,5 @@ int timerd_main_thread(void *data) timerd_server.run(timerd_parse_command, CTimerdMsg::ACTVERSION); printf("timerd shutdown complete\n"); - return 0; + return NULL; }