Subj : Re: timer thread & signal question To : comp.programming.threads From : Joseph Seigh Date : Fri Jan 07 2005 07:34 am On 6 Jan 2005 20:07:13 -0800, VK wrote: > Hi, > > Please help me with this newbie problem. I'm trying to set up a timer > thread with the signal handler. My problem is that when I have 2 > timers that go off at the same time, the signal SIGUSR2 is sent twice > to sigwait(), but since they are 2 identical signals, sigwait() sees it > as 1 signal only. How do I tell sigwait() that there are 2 of the same > signal? > > I tried sigwaitinfo() also as I thought sigwaitinfo() "returns the > queued signal value so that applications can differentiate between > multiple events queued to the same signal number". But it didn't do it > :( > > Can anyone please help me? Thanks a lot in advance. My test file is > as below. > [...] Don't use signals. I don't know what you think receipt of the signals mean since they're received *after* the times in question. Use pthread_timedwait and then do a gettimeofday() or something to get the current time since even pthread_timedwait has latency. Process whatever work needs to be done at that point. Joe Seigh .