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 |
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 |
All times are GMT -5. The time now is 05:18 PM. |