Subj : Re: timer thread & signal question To : comp.programming.threads From : Loic Domaigne Date : Fri Jan 07 2005 06:41 am Hello VK, > 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? SIGUSR2 is not queued. If you sent it x times, the process shall only receive it one time (this has less to do with sigwait() actually). You must used queued signal. If your implementation supports it, use realtime signal: signal whose number is between SIGRTMIN and SIGRTMAX. > 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 > :( Try your luck with realtime signal. Try for instance with RTMIN+2 (some pthread implementation uses internally RTMIN and RTMIN+1). HTH, Loic. .