diff options
author | Eric Wong <e@yhbt.net> | 2020-06-27 10:03:36 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-28 22:27:14 +0000 |
commit | b2b1006759730507731fcd3fc3e0de68239e3b92 (patch) | |
tree | e29d5c29682b05a5d87b9db1452dda92bde6a0d2 /lib/PublicInbox/In2Tie.pm | |
parent | 5808636263d72b635a46100a7e7037074dad8f75 (diff) | |
download | public-inbox-b2b1006759730507731fcd3fc3e0de68239e3b92.tar.gz |
Since we already use inotify and EVFILT_VNODE (kqueue) in -imapd, we might as well use them directly in -watch, too. This will allow public-inbox-watch to use PublicInbox::DS for timers to watch newsgroups/mailboxes and have saner signal handling in future commits.
Diffstat (limited to 'lib/PublicInbox/In2Tie.pm')
-rw-r--r-- | lib/PublicInbox/In2Tie.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/PublicInbox/In2Tie.pm b/lib/PublicInbox/In2Tie.pm index db1dc104..7dee3627 100644 --- a/lib/PublicInbox/In2Tie.pm +++ b/lib/PublicInbox/In2Tie.pm @@ -5,6 +5,19 @@ # on Linux::Inotify2 objects package PublicInbox::In2Tie; use strict; +use Symbol qw(gensym); + +sub io { + my $in2 = $_[0]; + $in2->blocking(0); + if ($in2->can('on_overflow')) { + # broadcasts everything on overflow + $in2->on_overflow(undef); + } + my $io = gensym; + tie *$io, __PACKAGE__, $in2; + $io; +} sub TIEHANDLE { my ($class, $in2) = @_; |