in reply to Re^2: Alarm and blocking I/O.
in thread Alarm and blocking I/O.

Try Perl::Unsafe::Signals

Replies are listed 'Best First'.
Re^4: Alarm and blocking I/O.
by expresspotato (Beadle) on May 29, 2010 at 19:25 UTC
    Thanks for your prompt reply BrowserUK. That still doesn't do the trick. The following code is used to include the Perl::Unsafe::Signals module.
    use Perl::Unsafe::Signals; print "Evaluating... \n"; #eval{ local $SIG{ALRM} = sub { $sys_check_mount{$mount_server} = 0; print "Alarm!"; exit(); }; alarm(5); print "Alarm Set... Trying system commands... \n"; UNSAFE_SIGNALS { print "Using unsafe signals... \n"; if (-e $mount_server_check_path && utime(undef, undef, "$m +ount_server_check_path/mount_check")){ #print "OK\n"; $sys_check_mount{$mount_server} = 1; }else{ #print "Broken\n"; $sys_check_mount{$mount_server} = 0; push (@mount_server_broken,$mount_server); } }; alarm(0); print "Reset Alarm... \n";
    Any other suggestions are appreciated :) Upon further investigation it seems something must be a-miss somewhere else in the program. The following code sniplet alarm's just fine:
    perl -e 'alarm shift @ARGV; exec @ARGV' 3 touch /node/store1/videos/mo +unt_check
      Maybe something disables the signals. Run your program via strace