//------------------------------------------------------------------------------ static void* processThread(void* pArgument_p) { tTimeruData* pTimer; sigset_t awaitedSignal; siginfo_t signalInfo; UNUSED_PARAMETER(pArgument_p); // Uncomment to show the thread ID on Linux (include must also be uncommented)! // DEBUG_LVL_TIMERU_TRACE("%s() ThreadId:%d\n", __func__, syscall(SYS_gettid)); sigemptyset(&awaitedSignal); sigaddset(&awaitedSignal, SIGRTMIN); pthread_sigmask(SIG_BLOCK, &awaitedSignal, NULL); /* loop forever until thread will be canceled */ while (1) { if (sigwaitinfo(&awaitedSignal, &signalInfo) > 0) { pTimer = (tTimeruData*)signalInfo.si_value.sival_ptr; if (pTimer != NULL) /* call callback function of timer */ cbTimer((ULONG)pTimer); else { DEBUG_LVL_ERROR_TRACE("%s() sival_ptr==NULL code=%d\n", __func__, signalInfo.si_code); } } } DEBUG_LVL_TIMERU_TRACE("%s() Exiting!\n", __func__); return NULL; }
//------------------------------------------------------------------------------ static void processTask(void) { tTimeruData* timer; while (TRUE) { timer = NULL; msgQReceive(timeruInstance_l.msgQueue, (char*)&timer, sizeof(ULONG), WAIT_FOREVER); if (timer != NULL) cbTimer(timer); else break; } }
//------------------------------------------------------------------------------ static void processTask(void) { ULONG timer; while (TRUE) { timer = 0; msgQReceive(timeruInstance_l.msgQueue, (char*)&timer, sizeof(ULONG), WAIT_FOREVER); if (timer != 0) { cbTimer(timer); } else { break; } } return; }