user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 7/6] ds: remove PLCMap and per-socket PostLoopCallback
Date: Mon, 3 Jun 2019 09:03:07 +0000	[thread overview]
Message-ID: <20190603090307.v2lvqwf2hb4tun64@whir> (raw)
In-Reply-To: <20190603015206.7871-1-e@80x24.org>

We don't need and won't be needing per-socket PostLoopCallbacks.
---
 lib/PublicInbox/DS.pm | 25 ++-----------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index 6b04e76..03612ce 100644
--- a/lib/PublicInbox/DS.pm
+++ b/lib/PublicInbox/DS.pm
@@ -58,7 +58,6 @@ our (
      @ToClose,                   # sockets to close when event loop is done
 
      $PostLoopCallback,          # subref to call at the end of each loop, if defined (global)
-     %PLCMap,                    # fd (num) -> PostLoopCallback (per-object)
 
      $LoopTimeout,               # timeout of event loop in milliseconds
      $DoneInit,                  # if we've done the one-time module init yet
@@ -85,7 +84,6 @@ sub Reset {
     @Timers = ();
 
     $PostLoopCallback = undef;
-    %PLCMap = ();
     $DoneInit = 0;
 
     # NOTE kqueue is close-on-fork, and we don't account for it, yet
@@ -389,18 +387,8 @@ The callback function will be passed two parameters: \%DescriptorMap
 sub SetPostLoopCallback {
     my ($class, $ref) = @_;
 
-    if (ref $class) {
-        # per-object callback
-        my PublicInbox::DS $self = $class;
-        if (defined $ref && ref $ref eq 'CODE') {
-            $PLCMap{$self->{fd}} = $ref;
-        } else {
-            delete $PLCMap{$self->{fd}};
-        }
-    } else {
-        # global callback
-        $PostLoopCallback = (defined $ref && ref $ref eq 'CODE') ? $ref : undef;
-    }
+    # global callback
+    $PostLoopCallback = (defined $ref && ref $ref eq 'CODE') ? $ref : undef;
 }
 
 # Internal function: run the post-event callback, send read events
@@ -426,11 +414,6 @@ sub PostEventLoop {
     # or global) cancels it
     my $keep_running = 1;
 
-    # per-object post-loop-callbacks
-    for my $plc (values %PLCMap) {
-        $keep_running &&= $plc->(\%DescriptorMap);
-    }
-
     # now we're at the very end, call callback if defined
     if (defined $PostLoopCallback) {
         $keep_running &&= $PostLoopCallback->(\%DescriptorMap);
@@ -580,10 +563,6 @@ sub _cleanup {
         }
     }
 
-    # now delete from mappings.  this fd no longer belongs to us, so we don't want
-    # to get alerts for it if it becomes writable/readable/etc.
-    delete $PLCMap{$self->{fd}};
-
     # we explicitly don't delete from DescriptorMap here until we
     # actually close the socket, as we might be in the middle of
     # processing an epoll_wait/etc that returned hundreds of fds, one
-- 
EW

      parent reply	other threads:[~2019-06-03  9:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03  1:52 [PATCH 0/6] ds: less is more Eric Wong
2019-06-03  1:52 ` [PATCH 1/6] ds: drop more unused subs Eric Wong
2019-06-03  1:52 ` [PATCH 2/6] ds: add a note about planned future changes Eric Wong
2019-06-03  1:52 ` [PATCH 3/6] ds: drop set_writer_func support Eric Wong
2019-06-03  1:52 ` [PATCH 4/6] ds: drop checks for invalid descriptors Eric Wong
2019-06-03  1:52 ` [PATCH 5/6] ds: drop unused EVENT: label in epoll code path Eric Wong
2019-06-03  1:52 ` [PATCH 6/6] ds: drop write_set_watch field Eric Wong
2019-06-03  9:03 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190603090307.v2lvqwf2hb4tun64@whir \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).