/*..........................................................................*/ int_t QF_run(void) { struct sched_param sparam; struct timeval timeout = { 0 }; /* timeout for select() */ QF_onStartup(); /* invoke startup callback */ /* try to maximize the priority of the ticker thread, see NOTE01 */ sparam.sched_priority = sched_get_priority_max(SCHED_FIFO); if (pthread_setschedparam(pthread_self(), SCHED_FIFO, &sparam) == 0) { /* success, this application has sufficient privileges */ } else { /* setting priority failed, probably due to insufficient privieges */ } l_running = (int_t)1; while (l_running) { QF_onClockTick(); /* clock tick callback (must call QF_TICK_X()) */ timeout.tv_usec = l_tickUsec; /* set the desired tick interval */ select(0, 0, 0, 0, &timeout); /* sleep for the desired tick, NOTE05 */ } QF_onCleanup(); /* invoke cleanup callback */ pthread_mutex_destroy(&QF_pThreadMutex_); return (int_t)0; /* return success */ }
/*..........................................................................*/ void QF_run(void) { struct sched_param sparam; struct timeval timeout = { 0 }; /* timeout for select() */ QF_onStartup(); /* invoke startup callback */ /* try to maximize the priority of the ticker thread, see NOTE01 */ sparam.sched_priority = sched_get_priority_max(SCHED_FIFO); if (pthread_setschedparam(pthread_self(), SCHED_FIFO, &sparam) == 0) { /* success, this application has sufficient privileges */ } else { /* setting priority failed, probably due to insufficient privieges */ } QS_OBJ_DICTIONARY(&l_ticker); /* the QS dictionary for the ticker */ l_running = (uint8_t)1; while (l_running) { QF_TICK(&l_ticker); /* process a time tick */ timeout.tv_usec = 8000; select(0, 0, 0, 0, &timeout); /* sleep for the full tick , NOTE05 */ } QF_onCleanup(); /* invoke cleanup callback */ pthread_mutex_destroy(&QF_pThreadMutex_); }
/*..........................................................................*/ void QF_stop(void) { QF_INT_LOCK_KEY_ QF_INT_LOCK_(); _dos_setvect(uCOS, l_dosSpareISR); /* restore the original DOS vector */ QF_INT_UNLOCK_(); QF_onCleanup(); /* cleanup callback */ }
/*..........................................................................*/ int_t QF_run(void) { QF_onStartup(); /* startup callback */ /* raise the priority of this (main) thread to tick more timely */ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); l_running = (int_t)1; while (l_running) { Sleep(l_tickMsec); /* wait for the tick interval */ QF_onClockTick(); /* clock tick callback (must call QF_TICKX()) */ } QF_onCleanup(); /* cleanup callback */ QS_EXIT(); /* cleanup the QSPY connection */ //DeleteCriticalSection(&l_win32CritSect); return (int_t)0; /* return success */ }
/*..........................................................................*/ void QF_run(void) { l_running = (uint8_t)1; QF_onStartup(); /* startup callback */ /* raise the priority of this (main) thread to tick more timely */ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); QS_OBJ_DICTIONARY(&l_ticker); /* the QS dictionary for the ticker */ while (l_running) { QF_TICK(&l_ticker); /* process a time tick */ Sleep(l_tickMsec); /* wait for the tick interval */ } QF_onCleanup(); /* cleanup callback */ QS_EXIT(); /* cleanup the QSPY connection */ DeleteCriticalSection(&QF_win32CritSect_); }
int_t QF_run(void) { QF_onStartup(); /* application-specific startup callback */ l_isRunning = true; /* QF is running */ /* set the ticker thread priority below normal to prevent * flooding other threads with time events when the machine * is very busy. */ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL); while (l_isRunning) { Sleep(l_tickMsec); /* wait for the tick interval */ QF_onClockTick(); /* clock tick callback (must call QF_TICKX()) */ } QF_onCleanup(); /* cleanup callback */ QS_EXIT(); /* cleanup the QSPY connection */ //DeleteCriticalSection(&l_win32CritSect); //free all "fudged" event pools... return (int_t)0; /* return success */ }
/*..........................................................................*/ void QF_stop(void) { QF_onCleanup(); /* cleanup callback */ }
/*..........................................................................*/ void QF_stop(void) { QF_onCleanup(); /* cleanup callback */ /* nothing else to do for the "vanilla" kernel */ }
/*..........................................................................*/ void QF_stop(void) { QF_INT_LOCK_KEY_ QF_INT_LOCK_(); QF_INT_UNLOCK_(); QF_onCleanup(); /* cleanup callback */ }
/*..........................................................................*/ void QF_stop(void) { QF_onCleanup(); /* cleanup callback */ /* nothing else to do for the QK preemptive kernel */ }