From: Eric Wong Date: Fri, 29 Jan 2021 07:42:59 +0000 (+0500) Subject: ipc: move on_destroy scope to inside the eval X-Git-Tag: v1.7.0~1274 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c0365a9fae1a72707fb78249861c80fed582d89b;p=public-inbox.git ipc: move on_destroy scope to inside the eval It saves us a line of code --- diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm index ece0e8b8..d2ff038d 100644 --- a/lib/PublicInbox/IPC.pm +++ b/lib/PublicInbox/IPC.pm @@ -119,13 +119,12 @@ sub ipc_worker_spawn { PublicInbox::DS::sig_setmask($sigset); # ensure we properly exit even if warn() dies: my $end = PublicInbox::OnDestroy->new($$, sub { exit(!!$@) }); - my $on_destroy = $self->ipc_atfork_child; eval { + my $on_destroy = $self->ipc_atfork_child; local %SIG = %SIG; ipc_worker_loop($self, $r_req, $w_res); }; die "worker $ident PID:$$ died: $@\n" if $@; - undef $on_destroy; undef $end; # trigger exit } PublicInbox::DS::sig_setmask($sigset) unless $oldset; @@ -336,13 +335,12 @@ sub _wq_worker_start ($$$) { PublicInbox::DS::sig_setmask($oldset); # ensure we properly exit even if warn() dies: my $end = PublicInbox::OnDestroy->new($$, sub { exit(!!$@) }); - my $on_destroy = $self->ipc_atfork_child; eval { + my $on_destroy = $self->ipc_atfork_child; local %SIG = %SIG; wq_worker_loop($self); }; warn "worker $self->{-wq_ident} PID:$$ died: $@" if $@; - undef $on_destroy; undef $end; # trigger exit } else { $self->{-wq_workers}->{$pid} = \undef;