LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-12-2005, 11:03 AM   #1
Thinking
Member
 
Registered: Oct 2003
Posts: 249

Rep: Reputation: 30
how to do waitpid() using a multi-threaded server?


hiho@ll

i'm running a multi-threaded server, which forks it's children
but my problem is, if the child exits it's a zombie process

in the server i'm using accept to wait for connections
so i don't realy have the time to do waitpid()

how can i terminate my childs without having a problem of missing a connection from a client?
is there a way to do this event-based
if a child exits, i do waitpid
??

thx@ll

Last edited by Thinking; 04-12-2005 at 11:05 AM.
 
Old 04-13-2005, 09:50 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 51
you can use wait3 or wait4 and pass the WNOHANG flag to them or better
when a child process ends Linux sends the parent a SIGCHILD signal
so all you have to do is handle SIGCHILD
 
  


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
multi-threaded server, pthreads, sleep Parahat Melayev Programming 6 01-17-2012 06:20 AM
pthreads - multi-threaded server elitecodex Programming 1 08-20-2005 03:58 PM
how to debug multi threaded application sibtay Programming 3 10-15-2004 12:02 PM
Segementation fault on Multi threaded server on ia-64 Linux Latha Linux - Software 3 09-09-2004 06:40 PM
Multi-Threaded C pragti Programming 1 06-01-2004 10:50 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration