clean up forking code in example
This commit is contained in:
parent
172e4a3041
commit
e7b4821844
|
@ -61,11 +61,17 @@ my $xml = qq#
|
|||
</document>
|
||||
#;
|
||||
|
||||
$SIG{CHLD} = "IGNORE";
|
||||
|
||||
while (my $request = $scgi->accept) {
|
||||
|
||||
# fork every new req into its own process (optional)
|
||||
next unless(my $pid = fork());
|
||||
my $pid = fork();
|
||||
|
||||
if ($pid) {
|
||||
$request->close();
|
||||
next;
|
||||
}
|
||||
|
||||
my $handle = $request->connection;
|
||||
|
||||
$request->read_env;
|
||||
|
@ -89,5 +95,9 @@ while (my $request = $scgi->accept) {
|
|||
#print $handle "Content-Type: text/xml\n\n";
|
||||
|
||||
print $handle $xml;
|
||||
exit if (!$pid);
|
||||
|
||||
exit unless $pid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue