Consider:
use strict; use warnings; use POSIX ":sys_wait_h"; my $pid = fork (); if ($pid == 0) { for (1 .. 10) { sleep 1; print 'c'; } } else { while (waitpid ($pid, WNOHANG) == 0) { print 'p'; sleep 1; } } print "\nDone\n";
Prints:
ppcpcpccpcpcpcpcpcpc Done p Done
In reply to Re: fork running parent and child parallel
by GrandFather
in thread fork running parent and child parallel
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |