]> Sergey Matveev's repositories - public-inbox.git/commitdiff
ds: add an in_loop() function for Inbox.pm use
authorEric Wong <e@yhbt.net>
Sun, 12 Jan 2020 21:17:48 +0000 (21:17 +0000)
committerEric Wong <e@yhbt.net>
Mon, 13 Jan 2020 23:21:21 +0000 (23:21 +0000)
Inbox.pm accessing the $in_loop variable directly raises
warnings when Inbox is loaded without DS.

lib/PublicInbox/DS.pm
lib/PublicInbox/Inbox.pm

index fe794512d50efae39c6c08e623eeb56519a85fb8..b441adc98b204d53cae1ed5ce99455940bdb9db5 100644 (file)
@@ -255,6 +255,8 @@ sub reap_pids {
 # reentrant SIGCHLD handler (since reap_pids is not reentrant)
 sub enqueue_reap ($) { push @$nextq, \&reap_pids };
 
+sub in_loop () { $in_loop }
+
 sub EpollEventLoop {
     local $in_loop = 1;
     do {
index ff80096528eb2301aae63c9389dba01421051868..e834d565da62915267898ce1dd7537dbabc390c3 100644 (file)
@@ -52,7 +52,7 @@ sub cleanup_task () {
 sub cleanup_possible () {
        # no need to require DS, here, if it were enabled another
        # module would've require'd it, already
-       eval { $PublicInbox::DS::in_loop } or return 0;
+       eval { PublicInbox::DS::in_loop() } or return 0;
 
        eval {
                require Devel::Peek; # needs separate package in Fedora