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 09-22-2004, 07:26 AM   #1
Registered: Sep 2004
Location: Hyderabad.
Posts: 83

Rep: Reputation: 15
Main thread sending notification to child thread

I want to know whether there is a mechanism/function in c in which main thread can send notification to the child thread about some event. And whether main thread can know the status of child thread i.e. whether it is running or sleeping etc. Can main thread restart the child thread with out actually killing it? what happens if main thread kills the child one and if child is in the middle of some process. I am using posix thread library <pthread.h>. If anyone can clarify this issue?

thanx in advance.
Old 09-22-2004, 09:15 AM   #2
Senior Member
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
There are several methods of inter-thread communication, including named pipes and shared memory. But what you want here I suspect is a signal (see the signal manpage for more).

You can find out the status of another process by examining the /proc/PID directory, and by function calls. I don't know how to do this but you may want to look at the source code for “top” to get some ideas.

If the child thread gets killed, it will die in the middle of whatever it's doing. What happens then depends on several factors, including how you killed it.


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 change and pass thread parameter back to main dragondad Programming 3 09-19-2005 01:58 PM
Alternative to child in C...thread maybe? zaichik Programming 1 09-09-2005 08:34 PM
[thread control suggestion] add a "solved" button that the thread starter can click atom LQ Suggestions & Feedback 3 03-24-2005 11:55 AM
configure qt thread issue (just compiled qt w/ -thread option) cleff Linux - Software 8 05-07-2004 11:11 PM
sending signal to thread waiting on pselect exedx Programming 4 03-21-2004 11:48 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:39 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
Open Source Consulting | Domain Registration