[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Failure to kill pid
- From: John Lorer <jdl136 mail usask ca>
- To: gtk-app-devel-list redhat com
- Subject: Re: Failure to kill pid
- Date: Mon, 30 Aug 1999 13:06:05 -0600
John Hawk wrote:
>
> The code below creates a fork to run grep.
> Code works correctly except for KILL resulting in an inability
> to reuse a grep file search. The question is why the PID goes Zombie vs
> being killed. Replace the PID with 0 and parent is killed as expected.
> Suggestions ?
>
[snip]
> void sigchld_handler (gint signal)
> {
> close (TASK_HANDLE);
> kill (TASK_PID,9);
> TASK_WORKING = FALSE;
> }
>
[snip]
See 'man 2 wait'. If a child process exits before its parent's process
and is not waited, it becomes a zombie. To prevent the zombie, use
wait(NULL); or waitpid(TASK_PID, status, options); after the kill().
Read the man page and decide which waitpid() options you need, and
whether you care you about status.
HTH
jdl
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]