LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Thread + signal problem (https://www.linuxquestions.org/questions/programming-9/thread-signal-problem-685160/)

Minimaalinen 11-21-2008 07:41 AM

Thread + signal problem
 
Hi all,

I use itimers to create signals in a main process. If I create a pthread and it's running in an infinite loop I can't block any signal (pthread_sigmask()) on main process. But if I don't create the thread everything works as expected.

What could be the problem?

pinniped 11-22-2008 05:03 PM

Is your pthread calling sched_yield() or hogging all of the process' time?

Mara 11-23-2008 01:38 PM

The reason is the way the pthread library works. Simply, everything interesting happens at the entry and exit of system calls (or the yield() function). Also, you should disable the signal on all other threads except the one you want it to go to.

Minimaalinen 11-24-2008 12:37 AM

Problem solved
 
Quote:

Originally Posted by Mara
Also, you should disable the signal on all other threads except the one you want it to go to.

That was the case. When I blocked signals from the other threads everything works fine. Thanks to All.


All times are GMT -5. The time now is 02:25 AM.