NAME

Linux::Event::Pid - pidfd-backed process-exit subscriptions for Linux::Event::Reactor

SYNOPSIS

<<<<<<< HEAD ======= use v5.36; use Linux::Event;

my $loop = Linux::Event->new( model => 'reactor' );

my $pid = fork() // die "fork: $!";
if ($pid == 0) { exit 42 }

>>>>>>> 1401c31 (prep for cpan and release, new tool added) my $sub = $loop->pid($pid, sub ($loop, $pid, $status, $data) { ... });

DESCRIPTION

Linux::Event::Pid adapts Linux pidfds into the reactor loop. It opens a pidfd using Linux::FD::Pid, watches it like any other readable filehandle, and invokes the callback when the target process exits.

Most users access it through $loop->pid(...).

CALLBACK ABI

Pid callbacks receive four arguments:

$cb->($loop, $pid, $status, $data)

When reap => 1 is in effect and the target is a child process, $status is the wait status value. Otherwise it may be undef.

OPTIONS

Recognized subscription options:

  • data

  • reap

SUBSCRIPTIONS

The returned subscription object supports cancel.

SEE ALSO

Linux::Event::Reactor, Linux::Event::Loop, Linux::FD::Pid