develooper Front page | perl.perl5.porters | Postings from November 1999

Re: wait and extra argument

Thread Next
M.J.T. Guy
November 10, 1999 08:27
Re: wait and extra argument
Message ID:
Ed Peschko <> wrote
> I'd like to wait for a given process, but no longer than x number of seconds.
> So, why doesn't:
> local($SIG{ALRM}) = sub { };
> alarm(100);
> my $pid = wait;
> print STDERR "GOT $pid in a max of 100 secs intervening!!!!\n";

Because you haven't written it right.   Follow the instructions
in the FAQ, i.e. make the $SIG{ALRM} do a die() and wrap it all in
an eval {}.

Mike Guy

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About