From: Eric Wong Date: Thu, 2 Nov 2023 09:35:26 +0000 (+0000) Subject: xap_helper.pm: use do_fork to Reset and reseed X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa8a5b0d3de5304aa56c53fd2f6717be9a44f559;p=thirdparty%2Fpublic-inbox.git 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. --- 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();