]> Sergey Matveev's repositories - public-inbox.git/commitdiff
processpipe: lazy-require PublicInbox::DS for dwaitpid
authorEric Wong <e@80x24.org>
Sat, 2 Jan 2021 09:13:40 +0000 (19:13 -1400)
committerEric Wong <e@80x24.org>
Sat, 2 Jan 2021 22:38:51 +0000 (22:38 +0000)
This saves over 20ms with scripts that only use PublicInbox::Spawn.

lib/PublicInbox/ProcessPipe.pm

index 400a22f3bf65a0a6eda398cee101d34c9fcb373a..e540dc220564160e7d012f3f1f0932053a3f4698 100644 (file)
@@ -5,7 +5,6 @@
 package PublicInbox::ProcessPipe;
 use strict;
 use v5.10.1;
-use PublicInbox::DS qw(dwaitpid);
 use Carp qw(carp);
 
 sub TIEHANDLE {
@@ -48,7 +47,8 @@ sub _close ($;$) {
                        carp "waitpid($pid, 0) = $wp, \$!=$!, \$?=$?";
                }
        } else { # caller just undef-ed it, let event loop deal with it
-               dwaitpid $pid, $cb, $arg;
+               require PublicInbox::DS;
+               PublicInbox::DS::dwaitpid($pid, $cb, $arg);
        }
        $ret;
 }