[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Regarding timers



On Thu, Apr 20, 2000 at 03:24:32PM +0530, vani wrote:
> Hello,
> 	I am using setitimer function to set the timer in my program. It
> is working fine. Now, i want to maintain another timer with different time
> interval. How do i differentiate between these timers so that i can call
> different functions based on which one has received the SIGALRM signal.
> 	Can anybody please help me out in this case.

There is no easy way. setitimer and alarm share the same clock and 
are not stackable i.e. a new call overwrites the old timer associated
with the process.

What you can do is - implement a timer manager module which creates
a timer to deliver a SIGALRM for the event closest to you. When
the signal is delivered, it examines the timer queue to figure out
who the signal goes to and when to schedule the next alarm.

I have a suspicion that if you look closely on the net, you'll find
someone who has already done it.

	-Arun