SIGALRM and timer
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?