What's the proper way to fork() in FastCGI ?
Posted
by eugene y
on Stack Overflow
See other posts from Stack Overflow
or by eugene y
Published on 2010-04-07T11:57:39Z
Indexed on
2010/04/07
12:13 UTC
Read the original article
Hit count: 263
I have an app running under Catalyst+FastCGI. And I want it to fork() to do some work in background. I used this code for plain CGI long ago:
defined(my $pid = fork) or die "Can't fork: $!";
if ($pid) {
# print response
exit 0;
}
die "Can't start a new session: $!" if setsid == -1;
close STDIN or die $!;
close STDOUT or die $!;
close STDERR or die $!;
# do some work in background
I tried some variations on this under FastCGI but with no success. How should forking be done under FastCGI?
© Stack Overflow or respective owner