Log in

View Full Version : signalling problem in linux


rijnahts
January 8th, 2009, 05:36
Hi,
I am facing signaling issue when I use the pthread_cond_wait() function.

I have a process which contians two threads.
1. Main Thread
2. New Thread

The Main Thread always looks for the signals which are queued in the OS level specific to that process.I am using "sigwaitinfo()" in the main thread, so that the main thread will not consume any cpu resource until there are any signals in the queue. In the "New Thread" I have used the SigPorocMasK() so that this thread will ignore all the signals and all the signals will be handled only in the "Main Thread".

What I wanted is from "New Thread" I wanted to send a signal to different process, and "New Thread" should not get executed until other process sends a signal. For this I have send the signal to other process using Kill() and immediatley i am using pthread_cond_wait() in the "New Thread". Because of this "New Thread" will not be executed until its get singalled using the condition variable. I am able to see the signal in the other process, but when is send signal from other process to my process, the "Main Thread" in my process is not getting any signal. I have also tried sending signgal to my process from the console, but no use.

My doubt is if we use pthread_cond_wait, does it stop all other threads in the same process to receive the signals.
Please help me on this...Please let me know if any one has better idea than this.


Thanks