LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 09-22-2004, 07:26 AM   #1
rajesh_b
Member
 
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.
rajesh.
 
Old 09-22-2004, 09:15 AM   #2
rjlee
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.
 
  


Reply



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

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

All times are GMT -5. The time now is 12:46 PM.

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
Open Source Consulting | Domain Registration