File: simple_fork.pl

package info (click to toggle)
libmojo-ioloop-readwriteprocess-perl 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 540 kB
  • sloc: perl: 4,655; sh: 101; makefile: 2
file content (15 lines) | stat: -rwxr-xr-x 209 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use warnings;
use strict;

my $pid1 = fork();
if ($pid1 == 0) {
  print "fork 1\n";
  sleep 1000;
}
my $pid2 = fork();
if ($pid2 == 0) {
  print "fork 2\n";
  sleep 1000;
}
waitpid $pid1, 0;
waitpid $pid2, 0;