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