From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 4E1D51F885 for ; Sun, 12 Jan 2020 21:17:57 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 03/11] ds: add an in_loop() function for Inbox.pm use Date: Sun, 12 Jan 2020 21:17:48 +0000 Message-Id: <20200112211756.23100-4-e@yhbt.net> In-Reply-To: <20200112211756.23100-1-e@yhbt.net> References: <20200112211756.23100-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Inbox.pm accessing the $in_loop variable directly raises warnings when Inbox is loaded without DS. --- lib/PublicInbox/DS.pm | 2 ++ lib/PublicInbox/Inbox.pm | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index 217799bb..3b9193b6 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -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 { diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index a3cdcbc0..0c59a8b1 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -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