Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 11-21-2008, 08:41 AM   #1
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, 06:03 PM   #2
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, 02:38 PM   #3
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,681

Rep: Reputation: 218Reputation: 218Reputation: 218
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, 01:37 AM   #4
LQ Newbie
Registered: Jul 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Problem solved

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.


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 01:11 PM
kernel thread and signal handling oriate Linux - General 3 10-18-2005 01:41 PM
how to send a signal to a thread stephenwalter Programming 2 10-17-2005 02:07 AM
Has anyone can give an example about using signal in thread? xhhuango Programming 2 09-15-2004 09:10 PM
sending signal to thread waiting on pselect exedx Programming 4 03-22-2004 12:48 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:13 PM.

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