587 sub run_on_wait { 588 my ($s,$code, $period)=@_; 589 590 $s->{on_wait}=$code; 591 $s->{on_wait_period} = $period; 592 } 593 594 sub on_wait { 595 my ($s)=@_; 596 597 if(ref($s->{on_wait}) eq 'CODE') { 598 $s->{on_wait}->(); 599 if (defined $s->{on_wait_period}) { 600 local $SIG{CHLD} = sub { } if ! defined $SIG{CHLD}; 601 select undef, undef, undef, $s->{on_wait_period} 602 }; 603 }; 604 };