Hello, I have been searching around for some information about a problem I have been having but haven't been able to find anything or I can't figure out how to apply what I have seen. Here is the scenario:
1)The main process creates a thread, sends a message to the thread using a message queue, then waits for a response (mq_receive).
2)The thread receives the message, starts a timer, and then sends a message back to the main process when the timer has expired (when it receives the SIGALRM signal).
The problem that is occurring is that as the main process is blocking in mq_receive, it is interrupted by the SIGALRM signal and fails receiving the message.
So my question is, is there any way to have the SIGALRM signal only go to the thread? Or for the main process to ignore the SIGALRM signal?
If you are using pthreads, each pthread has a signal mask (ie, a set of signals that it blocks). In order to direct a signal to a particular thread, you have to make all other threads (including the main program) block that signal.