Thread: SIGALRM and timer

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    134

    SIGALRM and timer

    Hi,

    Sorry for some open ended questions here. I am trying to write a code where I create a timer wheel and push different timers on it. The timer wheel contains the callback function and data that needs to be passed to the function. I am setting the timer using "setitimer" function. This function triggers SIGALRM on timer expiry. My signal handler walks over the timer wheel and run the callback code.

    Everything is fine as far as coding goes. May be its just my lack of understanding of signals. In the code, I create a timer wheel first and then fire all the timers at once. This is where the problem lies. Lets say for e.g. I push 2 timers on the wheel, one to fire after 5 secs and other after 6 secs.
    setitimer call that i use for firing the timer, resets the first timer to 6 sec (which was programmed for 5 secs) when it fires the second timer with 6 secs. So I can not have 2 different timers firing at 2 different intervals.

    Is there any way to achieve this?

    Thanks,

  2. #2
    Registered User
    Join Date
    Apr 2005
    Posts
    134
    The answer is in the link below

    http://dsnra.jpl.nasa.gov/pkg/timer-1.0/src/timer.c

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem with timer & signal
    By cangel in forum C Programming
    Replies: 1
    Last Post: 09-28-2008, 01:38 AM
  2. Replies: 4
    Last Post: 12-20-2007, 07:55 PM