B
bsder
Hi,
I m not sure whether the following Perl code is correct with fork().
while (1) {
if (open( FILE, "< $books" ) {
if (!defined($kidpid = fork())) {
die "cannot fork: $!";
}
elsif ($kidpid == 0) { # child
child_func();
}
else # parent.
sleep(1);
}
}
Can anyone please give comment and suggestion of improving it?
Thanks
Sam
I m not sure whether the following Perl code is correct with fork().
while (1) {
if (open( FILE, "< $books" ) {
if (!defined($kidpid = fork())) {
die "cannot fork: $!";
}
elsif ($kidpid == 0) { # child
child_func();
}
else # parent.
sleep(1);
}
}
Can anyone please give comment and suggestion of improving it?
Thanks
Sam