Timer in Win32
-
Hi, I am trying to have a timer facility with the following constraints, 1. The call back routine must be processed as fast as possible after the timer expires, though windows is not a RTOS, how close can we achieve this? 2. The callback routine must be run asynchronously. The thread should be able to assign a callback to be run after a particular period of time and continue with its tasks without being bothered to wait on that timer. Given the choices available in windows, CreateTimerQueue, Multimedia timers, Waitable timers, SetTimer fn. Settimer is a plain fn, which does not guarantee prompt processing (WM_TIMER is has least priority). Timer queue implementation relies on thread pooling concept whose performance is a question when we think about RT performance. Multimedia timers allow only a few functions to be used in the calling function which makes it impossible to use mutex or semaphore fns in it. Waitable timers, block the calling thread. Is there any other timer / or implementation that would help me achieve the above constraints? Thanks 'n Regards, S.Senthilkumar
-
Hi, I am trying to have a timer facility with the following constraints, 1. The call back routine must be processed as fast as possible after the timer expires, though windows is not a RTOS, how close can we achieve this? 2. The callback routine must be run asynchronously. The thread should be able to assign a callback to be run after a particular period of time and continue with its tasks without being bothered to wait on that timer. Given the choices available in windows, CreateTimerQueue, Multimedia timers, Waitable timers, SetTimer fn. Settimer is a plain fn, which does not guarantee prompt processing (WM_TIMER is has least priority). Timer queue implementation relies on thread pooling concept whose performance is a question when we think about RT performance. Multimedia timers allow only a few functions to be used in the calling function which makes it impossible to use mutex or semaphore fns in it. Waitable timers, block the calling thread. Is there any other timer / or implementation that would help me achieve the above constraints? Thanks 'n Regards, S.Senthilkumar
TIMDLL from http://codeproject.com/ccp/JpmTimers.asp or BOSDLL from http://codeproject.com/ccp/BOS.asp had just this in mind. Both use a MultiMedia timer, it trips a heart-beating thread (every millisecond) which: - 1) spins-a-thread(starting at user supplied entry point), 2) causes a function execution(starting at user supplied entry point) or 3) sets an event-flag as the user has specified. It is accurate to one millisecond. Lymington
-
TIMDLL from http://codeproject.com/ccp/JpmTimers.asp or BOSDLL from http://codeproject.com/ccp/BOS.asp had just this in mind. Both use a MultiMedia timer, it trips a heart-beating thread (every millisecond) which: - 1) spins-a-thread(starting at user supplied entry point), 2) causes a function execution(starting at user supplied entry point) or 3) sets an event-flag as the user has specified. It is accurate to one millisecond. Lymington