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
. Each function is exported in two flavors: predicate-style pid
and lambda-style pid_lambda
.
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
pid_lambda
:pid_lambda ($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 issignal_lambda
:signal_lambda ($SIG, $TIMEOUT) :: () -> boolean
SEE ALSO
AUTHOR
Dmitry Karasik, <dmitry@karasik.eu.org>.