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

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

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;
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
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


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