}
sub ipc_worker_reap { # dwaitpid callback
- my ($self, $pid) = @_;
+ my ($args, $pid) = @_;
return if !$?;
# TERM(15) is our default exit signal, PIPE(13) is likely w/ pager
my $s = $? & 127;
}
sub wq_wait_old {
- my ($self) = @_;
+ my ($self, $args) = @_;
my $pids = delete $self->{"-wq_old_pids.$$"} or return;
- dwaitpid($_, \&ipc_worker_reap, $self) for @$pids;
+ dwaitpid($_, \&ipc_worker_reap, [$self, $args]) for @$pids;
}
# for base class, override in sub classes
# idempotent, can be called regardless of whether worker is active or not
sub ipc_worker_stop {
- my ($self) = @_;
+ my ($self, $args) = @_;
my ($pid, $ppid) = delete(@$self{qw(-ipc_pid -ipc_ppid)});
my ($w_req, $r_res) = delete(@$self{qw(-ipc_req -ipc_res)});
if (!$w_req && !$r_res) {
$w_req = $r_res = undef;
return if $$ != $ppid;
- dwaitpid($pid, \&ipc_worker_reap, $self);
+ dwaitpid($pid, \&ipc_worker_reap, [$self, $args]);
}
# use this if we have multiple readers reading curl or "pigz -dc"
my $has_l2m = exists $lei->{l2m};
for my $f (qw(lxs l2m)) {
my $wq = delete $lei->{$f} or next;
- $wq->wq_wait_old;
+ $wq->wq_wait_old($lei);
}
$lei->{ovv}->ovv_end($lei);
if ($has_l2m) { # close() calls LeiToMail reap_compress
my ($lei) = @_;
my $lxs = delete $lei->{lxs};
if ($lxs && $lxs->wq_kill_old) { # is this the daemon?
- $lxs->wq_wait_old;
+ $lxs->wq_wait_old($lei);
}
close(delete $lei->{1}) if $lei->{1};
$lei->x_it(13);