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,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 8C4091F46C for ; Fri, 29 Nov 2019 10:14:14 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/7] ds: ->Reset initializes $nextq Date: Fri, 29 Nov 2019 10:14:10 +0000 Message-Id: <20191129101414.343-4-e@80x24.org> In-Reply-To: <20191129101414.343-1-e@80x24.org> References: <20191129101414.343-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: I haven't noticed this being a problem in practice, but be consistent with the rest of the singleton stuff. Since we always call Reset() at load time, only do initialization in that sub and not at declaration. --- lib/PublicInbox/DS.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index 17c640f4..301ec057 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -39,8 +39,8 @@ use Errno qw(EAGAIN EINVAL); use Carp qw(croak confess carp); require File::Spec; -my $nextq = []; # queue for next_tick -my $WaitPids = []; # list of [ pid, callback, callback_arg ] +my $nextq; # queue for next_tick +my $WaitPids; # list of [ pid, callback, callback_arg ] my $reap_timer; our ( %DescriptorMap, # fd (num) -> PublicInbox::DS object @@ -69,6 +69,7 @@ Reset all state =cut sub Reset { %DescriptorMap = (); + $nextq = []; $WaitPids = []; $reap_timer = undef; @ToClose = ();