timerd.cpp: Fix thread declarations, typos, and improve timerd_main_thread consistency

Origin commit data
------------------
Branch: ni/coolstream
Commit: 7571071f60
Author: GetAway <get-away@t-online.de>
Date: 2024-11-16 (Sat, 16 Nov 2024)


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

------------------
This commit was generated by Migit
This commit is contained in:
GetAway
2024-11-16 10:58:20 +01:00
committed by vanhofen
parent 1f60833aed
commit 8a4e66e252
2 changed files with 10 additions and 9 deletions

View File

@@ -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();

View File

@@ -260,7 +260,7 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd)
break;
}
case CTimerdMsg::CMD_ADDTIMER: // neuen timer hinzuf<EFBFBD>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<EFBFBD>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;
}