1 # Copyright (C) 2020 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 package PublicInbox::EOFpipe;
6 use parent qw(PublicInbox::DS);
7 use PublicInbox::Syscall qw(EPOLLIN EPOLLONESHOT);
10 my (undef, $rd, $cb, $arg) = @_;
11 my $self = bless { cb => $cb, arg => $arg }, __PACKAGE__;
12 # 1031: F_SETPIPE_SZ, 4096: page size
13 fcntl($rd, 1031, 4096) if $^O eq 'linux';
14 $self->SUPER::new($rd, EPOLLIN|EPOLLONESHOT);
19 if ($self->do_read(my $buf, 1) == 0) { # auto-closed
20 $self->{cb}->($self->{arg});