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 11C141F461 for ; Mon, 24 Jun 2019 02:55:33 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 20/57] ds: remove IO::Poll support (for now) Date: Mon, 24 Jun 2019 02:52:21 +0000 Message-Id: <20190624025258.25592-21-e@80x24.org> In-Reply-To: <20190624025258.25592-1-e@80x24.org> References: <20190624025258.25592-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It may be reinstated at a later time if there's interest; but I want to be able to use one-shot notifications for certain events while retaining level-triggered notifications others. OTOH, I intend to fully support kqueue; via IO::KQueue for now, but via syscall() eventually to take advantage of the syscall reduction kevent(2) can provide over (current) epoll APIs. --- lib/PublicInbox/DS.pm | 52 ------------------------------------------- 1 file changed, 52 deletions(-) diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index 943e30b5..9c801214 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -168,11 +168,6 @@ sub _InitPoller *EventLoop = *EpollEventLoop; } } - - if (!$HaveEpoll && !$HaveKQueue) { - require IO::Poll; - *EventLoop = *PollEventLoop; - } } =head2 C<< CLASS->EventLoop() >> @@ -190,8 +185,6 @@ sub FirstTimeEventLoop { EpollEventLoop($class); } elsif ($HaveKQueue) { KQueueEventLoop($class); - } else { - PollEventLoop($class); } } @@ -250,51 +243,6 @@ sub EpollEventLoop { exit 0; } -### The fallback IO::Poll-based event loop. Gets installed as EventLoop if -### IO::Epoll fails to load. -sub PollEventLoop { - my $class = shift; - - my PublicInbox::DS $pob; - - while (1) { - my $timeout = RunTimers(); - - # the following sets up @poll as a series of ($poll,$event_mask) - # items, then uses IO::Poll::_poll, implemented in XS, which - # modifies the array in place with the even elements being - # replaced with the event masks that occured. - my @poll; - while ( my ($fd, $sock) = each %DescriptorMap ) { - push @poll, $fd, $sock->{event_watch}; - } - - # if nothing to poll, either end immediately (if no timeout) - # or just keep calling the callback - unless (@poll) { - select undef, undef, undef, ($timeout / 1000); - return unless PostEventLoop(); - next; - } - - my $count = IO::Poll::_poll($timeout, @poll); - unless ($count >= 0) { - return unless PostEventLoop(); - next; - } - - # Fetch handles with read events - while (@poll) { - my ($fd, $state) = splice(@poll, 0, 2); - $DescriptorMap{$fd}->event_step if $state; - } - - return unless PostEventLoop(); - } - - exit 0; -} - ### The kqueue-based event loop. Gets installed as EventLoop if IO::KQueue works ### okay. sub KQueueEventLoop { -- EW