From aa8a5b0d3de5304aa56c53fd2f6717be9a44f559 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 2 Nov 2023 09:35:26 +0000 Subject: [PATCH] xap_helper.pm: use do_fork to Reset and reseed We may start using rand() in the worker someday if we need to seed a hash function for caching. It saves us some LoC in the meantime. --- lib/PublicInbox/XapHelper.pm | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/PublicInbox/XapHelper.pm b/lib/PublicInbox/XapHelper.pm index f7640f4c9..41c66a121 100644 --- a/lib/PublicInbox/XapHelper.pm +++ b/lib/PublicInbox/XapHelper.pm @@ -216,14 +216,9 @@ sub reap_worker { # awaitpid CB sub start_worker ($) { my ($nr) = @_; - my $pid = fork; - if (!defined($pid)) { - warn("fork: $!"); - return undef; - }; + my $pid = eval { PublicInbox::DS::do_fork } // return(warn($@)); if ($pid == 0) { undef %WORKERS; - PublicInbox::DS::Reset(); $SIG{TTIN} = $SIG{TTOU} = 'IGNORE'; $SIG{CHLD} = 'DEFAULT'; # Xapian may use this recv_loop(); -- 2.47.2