if (!defined($kidpid = fork())){ # fork returned undef, so failed die "cannot fork: $!"; }elsif ($kidpid == 0) { # fork returned 0, so this branch is the child $TestResult = &$TEST_PROCESS($_[0], $_[1]); # &$TEST_PROCESS is a subroutine that is written in some other file that will return 1 if success exit; # terminate the child thread... } else { for ($timer=0;$timer<=$TEST_TIMEOUT;$timer++) { #### } }