From 8a4e66e252fcb16e9e83d677ab58bc8dcbe58e37 Mon Sep 17 00:00:00 2001 From: GetAway Date: Sat, 16 Nov 2024 10:58:20 +0100 Subject: [PATCH] timerd.cpp: Fix thread declarations, typos, and improve timerd_main_thread consistency Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7571071f605c1cd48a53991a2f371ba3e806502a Author: GetAway Date: 2024-11-16 (Sat, 16 Nov 2024) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/neutrino.cpp | 8 ++++---- src/timerd/timerd.cpp | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) 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; }