diff options
author | Eric Wong <e@80x24.org> | 2019-06-27 21:21:03 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-06-29 19:59:00 +0000 |
commit | 6306663a3b4167edfd5b1fd640233da96fe9e32f (patch) | |
tree | 69c451c494fccf1aff8e863983c98804104d5546 /lib/PublicInbox/DS.pm | |
parent | 858ab5cfe5fffa6c5a4221a523db3682be8fae06 (diff) | |
download | public-inbox-6306663a3b4167edfd5b1fd640233da96fe9e32f.tar.gz |
We'll be reusing requeue in other places to reduce trips to the kernel to retrieve "hot" descriptors.
Diffstat (limited to 'lib/PublicInbox/DS.pm')
-rw-r--r-- | lib/PublicInbox/DS.pm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index 28240843..9f245347 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -37,6 +37,8 @@ use Errno qw(EAGAIN EINVAL EEXIST); use Carp qw(croak confess carp); require File::Spec; +my $nextt; # timer for next_tick +my $nextq = []; # queue for next_tick our ( %DescriptorMap, # fd (num) -> PublicInbox::DS object $Epoll, # Global epoll fd (or DSKQXS ref) @@ -594,6 +596,18 @@ sub shutdn ($) { } } +sub next_tick () { + $nextt = undef; + my $q = $nextq; + $nextq = []; + $_->event_step for @$q; +} + +sub requeue ($) { + push @$nextq, $_[0]; + $nextt ||= PublicInbox::EvCleanup::asap(*next_tick); +} + package PublicInbox::DS::Timer; # [$abs_float_firetime, $coderef]; sub cancel { |