[poe-commits] SF.net SVN: poe: [2319] trunk/poe/lib/POE/Kernel.pm
Brought to you by:
rcaputo
From: <rc...@us...> - 2008-04-28 06:16:14
|
Revision: 2319 http://poe.svn.sourceforge.net/poe/?rev=2319&view=rev Author: rcaputo Date: 2008-04-27 23:16:20 -0700 (Sun, 27 Apr 2008) Log Message: ----------- Per Marc Lehmann's feedback, I have documented how to avoid a potential race condition when catching child processes with sig_child(). Basically, if you want sig_child() to catch a process, call the method in the same event handler that forked the process. Otherwise POE::Kernel may reap the process before sig_child() is called. Modified Paths: -------------- trunk/poe/lib/POE/Kernel.pm Modified: trunk/poe/lib/POE/Kernel.pm =================================================================== --- trunk/poe/lib/POE/Kernel.pm 2008-04-26 09:13:50 UTC (rev 2318) +++ trunk/poe/lib/POE/Kernel.pm 2008-04-28 06:16:20 UTC (rev 2319) @@ -4525,7 +4525,7 @@ the PROCESS_ID. A session may register as many sig_child() handlers as necessary, but -there may only be one per PROCESS_ID. +a session may only have one per PROCESS_ID. sig_child() watchers are one-shot. They automatically unregister themselves once the EVENT_NAME has been delivered. @@ -4533,6 +4533,11 @@ sig_child() watchers keep a session alive for as long as they are active. This is unique among 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. + sig_chid() does not return a meaningful value. sub forked_parent { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |