NAME

IO::Lambda::Signal - Wait for pid/signal or timeout

DESCRIPTION

The module provides access to signal-based callbacks, generic signal listener signal and process ID listener pid.

SYNOPSIS

   use strict;
   use IO::Lambda qw(:all);
   use IO::Lambda::Signal qw(pid);

   my $pid = fork;
   exec "/bin/ls" unless $pid;
   lambda {
       context $pid, 5;
       pid {
          my $ret = shift;
	  print defined($ret) ? ("exitcode(", $ret>>8, ")\n") : "timeout\n";
       }
   }-> wait;

USAGE

pid ($PID, $TIMEOUT) -> $?|undef

Accepts PID and optional deadline/timeout, returns either process exit status, or undef on timeout. The corresponding lambda is new_pid :

new_pid ($PID, $TIMEOUT) :: () -> $?|undef
signal ($SIG, $TIMEOUT) -> boolean

Accepts signal name and optional deadline/timeout, returns 1 if signal was caught, or undef on timeout. The corresponding lambda is new_signal :

new_signal ($SIG, $TIMEOUT) :: () -> boolean

SEE ALSO

IO::Lambda

AUTHOR

Dmitry Karasik, <dmitry@karasik.eu.org>.