Browse files

Docment that waitpid() calls interfere with sig_child().

Programs that reap their own child processes AND use sig_child() to
watch for those processes MUST call sig_child($pid, undef) to clear
the watchers.  sig_child() only notifies programs after some event
loop reaps the process.  If an application reaps it first, POE may
never know the child went away.
  • Loading branch information...
1 parent 9bb1bd7 commit f27fa471d95ac270c1a927a27438587cc92bccf8 @rcaputo committed Jun 28, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/POE/
@@ -4675,13 +4675,17 @@ in continuing to watch for a signal that will never come again. Other
signal handlers persist until they are cleared.
sig_child() watchers keep a session alive for as long as they are
-active. This is unique among signal watchers.
+active. This is unique among POE's signal watchers.
Programs that wish to reliably reap child processes should be sure to
call sig_child() before returning from the event handler that forked
the process. Otherwise POE::Kernel may have an opportunity to call
waitpid() before an appropriate event watcher has been registered.
+Programs that reap processes with waitpid() must clear POE's watchers
+for the same process IDs, otherwise POE will wait indefinitely for
+processes that never send signals.
sig_child() does not return a meaningful value.
sub forked_parent {

0 comments on commit f27fa47

Please sign in to comment.