in reply to Re^4: Cannot catch ALRM signal for timeout
in thread Cannot catch ALRM signal for timeout
where the t.pl issub process_scheme{ my ($output_file) = @_; open (OUTPUT_FILE, ">", $output_file) || die "cannot open log file +"; my $scheme_pid = open (SCHEME, "./t.pl | ") || die "cannot pipe sc +heme"; my $str = ""; MAIN: while (1) { eval{ local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n require +d alarm 5;#$allow_time; if (eof(SCHEME)){ close OUTPUT_FILE; close SCHEME; last MAIN; } $str = <SCHEME>; alarm 0; }; if ($@) { close OUTPUT_FILE; kill $scheme_pid; close SCHEME; return -$current_player; } # process the line print OUTPUT_FILE $str; } return 1; }
The script gets stuck, waiting forever, not stopping/returning anythingwhile(1){};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Cannot catch ALRM signal for timeout
by almut (Canon) on Dec 08, 2009 at 23:35 UTC | |
|
Re^6: Cannot catch ALRM signal for timeout
by ikegami (Patriarch) on Dec 08, 2009 at 22:45 UTC |