tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wait(2) and SIGCHLD



	hello.  I think Mouse said it best.  There is a difference between
SIG_DFL and SIG_IGN, which is how you can not get signaled when a child
exists, but wait(2) will still wait for a child  if you call it.

Hope that helps.
-Brian

On Aug 14, 10:10am, Brian Buhrow wrote:
} Subject: Re: wait(2) and SIGCHLD
} 	Hello.  I'm not sure I've completely understood your question, but I
} think you're confusing the issue of whether a child posts a SIGCHLD signal
} when it exits versus whether the current process that's calling wait(2)
} receives a SIGCHLD when a child exits.  The default behavior, as I
} understand it, is that if a process has children, by default, it will not
} get signaled if those children terminate.  However, if that process then
} calls wait(2), it will hang until a child terminates, regardless of whether
} it's configured to receive the SIGCHLD or not.  In that instance, I think
} the man page is wrong, at least if code I have running is to be believed.  So,
} I think there's no difference between the default ignoring of the SIGCHLD
} signal and explicitly ignoring it.
} -Brian
} 
} On Aug 14,  1:51pm, Edgar =?iso-8859-1?B?RnXf?= wrote:
} } Subject: wait(2) and SIGCHLD
} } I'm confused regarding the behaviour of wait(2) wrt. SIGCHLD handling.
} } 
} } The wait(2) manpage says:
} } 
} } 	wait() will fail and return immediately if:
} } 	[ECHILD]	The calling process has no existing unwaited-for child
} } 			processes; or no status from the terminated child
} } 			process is available because the calling process has
} } 			asked the system to discard such status by ignoring
} } 			the signal SIGCHLD or setting the flag SA_NOCLDWAIT
} } 			for that signal.
} } 
} } However, ignore is the default handler for SIGCHLD.
} } 
} } So does the
} } 	because the calling process has asked the system
} } 	to discard such status by ignoring the signal SIGCHLD
} } mean that explicitly ignoring SIGCHLD is different from ignoring it per default?
} >-- End of excerpt from Edgar =?iso-8859-1?B?RnXf?=
} 
} 
>-- End of excerpt from Brian Buhrow




Home | Main Index | Thread Index | Old Index