12 #include "../mythreads.h"
20 struct UpdateThreadData
23 volatile bool shutdown;
34 static UpdateThreadData S_updateThreadData;
36 static void* PerformUpdateThreadWorkerFunction(
void* pThreadData )
38 const UpdateThreadData* pUpdateThreadData = (UpdateThreadData*)pThreadData;
42 while( !error && !pUpdateThreadData->shutdown ) {
45 FunctionResult fr = pUpdateThreadData->pUpdateModule->performUpdate(force, results);
52 for (
size_t k=0; k<60 && !pUpdateThreadData->shutdown; ++k)
61 static pthread_t S_hUpdateThread = 0;
65 S_updateThreadData.pUpdateModule = &aUpdateModule;
66 S_updateThreadData.error = errorSignal;
68 pthread_create(&S_hUpdateThread , NULL, PerformUpdateThreadWorkerFunction, (
void*)&S_updateThreadData);
73 S_updateThreadData.shutdown =
true;
74 pthread_join(S_hUpdateThread, NULL);
77 void mySleep(
unsigned nTimeMs )
80 sleeptime.tv_sec = nTimeMs / 1000;
81 sleeptime.tv_nsec = 1000*1000*(nTimeMs % 1000);
85 while( nanosleep( &sleeptime, &remaintime ) == -1 )
87 int tmp_errno = errno;
88 if( tmp_errno != EINTR ) {
93 sleeptime.tv_sec = remaintime.tv_sec;
94 sleeptime.tv_nsec = remaintime.tv_nsec;