diff options
author | Eric Wong <e@80x24.org> | 2023-11-02 09:35:33 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-11-03 06:39:30 +0000 |
commit | cfe25e6aa966144a9c96d1ba2c301fd5e1bad79b (patch) | |
tree | 4faa9092c422aafca9568e547634096da12667e9 /lib/PublicInbox/Qspawn.pm | |
parent | 16957ad7c4edcbf43294e67c8db06167594f0660 (diff) | |
download | public-inbox-cfe25e6aa966144a9c96d1ba2c301fd5e1bad79b.tar.gz |
This fixes two major problems with the use of tie for filehandles: * no way to do fcntl, stat, etc. calls directly on the tied handle, forcing callers to use the `tied' perlop to access the underlying IO::Handle * needing separate classes to handle blocking and non-blocking I/O As a result, Git->cleanup_if_unlinked, InputPipe->consume, and Qspawn->_yield_start have fewer bizzare bits and we can call `$io->blocking(0)' directly instead of `(tied *$io)->{fh}->blocking(0)' Having a PublicInbox::IO class will also allow us to support custom read buffering which allows inspecting the current state.
Diffstat (limited to 'lib/PublicInbox/Qspawn.pm')
-rw-r--r-- | lib/PublicInbox/Qspawn.pm | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm index a03e1b01..0bf857c6 100644 --- a/lib/PublicInbox/Qspawn.pm +++ b/lib/PublicInbox/Qspawn.pm @@ -149,7 +149,7 @@ sub finish ($;$) { # we can safely finalize if pipe was closed before, or if # {_err} is defined by waitpid_err. Deleting {rpipe} will - # trigger PublicInbox::ProcessIO::DESTROY -> waitpid_err, + # trigger PublicInbox::IO::DESTROY -> waitpid_err, # but it may not fire right away if inside the event loop. my $closed_before = !delete($self->{rpipe}); finalize($self) if $closed_before || defined($self->{_err}); @@ -244,9 +244,8 @@ sub ipipe_cb { # InputPipe callback sub _yield_start { # may run later, much later... my ($self) = @_; if ($self->{psgi_env}->{'pi-httpd.async'}) { - require PublicInbox::ProcessIONBF; my $rpipe = $self->{rpipe}; - PublicInbox::ProcessIONBF->replace($rpipe); + $rpipe->blocking(0); PublicInbox::InputPipe::consume($rpipe, \&ipipe_cb, $self); } else { require PublicInbox::GetlineResponse; |