Re: Interval timers on Fedora





John Wendel wrote:
Douglas Phillipson wrote:
This probably isn't a Fedora specific question so I apologize if this is the wrong forum.

Anybody know if you can set more than one interval timer in a single process?

(setitimer())

Would starting more than one interval timer in a single process confuse the signal system when delivering the SIGALRM to the receiving process?

In other words, can I have a 10 second interval timer which when times out delivers a sigalrm to one function, and in the same process have a 1 second interval timer set to give a sigalrm to another function?

I'm having trouble with a second interval timer, it doesn't seem to work, or deliver the signal to the desired function. I'm using a separate instance of struct itimerval and struct sigaction when setting up the timers. I have several books on the subject of interval timers but none say you shouldn't do this, just "Every process has its own set of timers". But they might be referring to REAL, VIRTUAL, and PROF timers, a single set of these for each process.

Opinions requested...

Thanks

Doug P


I'm not an expert on this stuff, but my understanding is that setitimer gives your process access to one of three predefined timers (REAL, VIRTUAL, and PROF) and only the REAL timer is actually useful.
So your second call to setitimer is mucking up the settings from the first call.

See "man timer_create" for the POSIX timer stuff that lets you have lots of timers.

I recommend the O'REILLY book POSIX 4 by Bill Gallmeister for a good explanation of this fairly complicated topic.

Regards,

John


My result on the timer issue is that a interval timer won't call its timeout function while msgrcv() is waiting for a message on a queue.

Regards

Doug P

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list



Relevant Pages

  • Re: Interval timers on Fedora
    ... Would starting more than one interval timer in a single process confuse the signal system when delivering the SIGALRM to the receiving process? ... In other words, can I have a 10 second interval timer which when times out delivers a sigalrm to one function, and in the same process have a 1 second interval timer set to give a sigalrm to another function? ...
    (Fedora)
  • Re: Is there a problem in timeval_to_jiffies?
    ... >>Timers are constrained by the standard to NEVER finish early. ... that a given timer signal can be delayed while the next signal ... The timer resolution is a function of what the hardware can ... > I want to have an interval timer for each second. ...
    (Linux-Kernel)
  • Re: Is there a problem in timeval_to_jiffies?
    ... No interval timer can guarantee, ... I want to have an interval timer for each second. ... Your approach would trigger the timer in at least one second. ... have to use one-shot timers and restart them after each ...
    (Linux-Kernel)
  • Re: regarding timeout/untimeout kernel functions
    ... > You could also use the kqueue/kevent functions to queue up an arbitrary ... > number of timer events in a single process. ... timer on a quantum which in turn calls into a timer list module I wrote, ...
    (freebsd-hackers)
  • Re: Waitable Timers
    ... In addition - there is no need even to use named timers in one application. ... Vladimir ... > If you are using a timer in a single process application, ... > same timer object, also, the first parameter for this function is ...
    (microsoft.public.win32.programmer.kernel)