in reply to Re: Re: creating a fork process
in thread creating a fork process
Hope this is of more help than the first posters comment. We all had to start once#!/usr/bin/perl -w use strict; use CGI; use Errno qw(EAGAIN); my $pid; my $page = new CGI; print $page->header(), $page->start_html(); FORK: { if ($pid = fork()) { print <<HTML; <CENTER> In the parent process<BR> HTML print $page->end_html(); exit; } elsif (defined $pid) { print <<HTML; <CENTER> In the child process<BR> HTML print $page->end_html(); close STDIN; close STDOUT; close STDERR; exec ('sleep 60'); exit; } elsif ($! == EAGAIN) { print qq(Re-doing fork\n); sleep 5; redo FORK; } else { die qq(Can't fork: $!'n); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: creating a fork process
by richp (Initiate) on Feb 10, 2002 at 23:20 UTC |