Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. System Admin
  4. Timer in Win32

Timer in Win32

Scheduled Pinned Locked Moved System Admin
questiondata-structuresperformancehelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    funduMan
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • F funduMan

      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

      L Offline
      L Offline
      Lymington
      wrote on last edited by
      #2

      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

      F 1 Reply Last reply
      0
      • L 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

        F Offline
        F Offline
        funduMan
        wrote on last edited by
        #3

        Thank you Lymington for your reply. I am currently trying to understand your code. Yours S.Senthlkumar

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups