LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-21-2008, 07:41 AM   #1
Minimaalinen
LQ Newbie
 
Registered: Jul 2008
Posts: 2

Rep: Reputation: 0
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?
 
Old 11-22-2008, 05:03 PM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Is your pthread calling sched_yield() or hogging all of the process' time?
 
Old 11-23-2008, 01:38 PM   #3
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,667

Rep: Reputation: 217Reputation: 217Reputation: 217
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.
 
Old 11-24-2008, 12:37 AM   #4
Minimaalinen
LQ Newbie
 
Registered: Jul 2008
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to reinstall a signal handler after exec ( Strange behaviour in signal handling ) lali.p Programming 0 09-20-2008 12:11 PM
kernel thread and signal handling oriate Linux - General 3 10-18-2005 12:41 PM
how to send a signal to a thread stephenwalter Programming 2 10-17-2005 01:07 AM
Has anyone can give an example about using signal in thread? xhhuango Programming 2 09-15-2004 08:10 PM
sending signal to thread waiting on pselect exedx Programming 4 03-21-2004 11:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration