Am Sun, 8 Nov 2020 21:10:31 -0500 schrieb John Cowan cowan@ccil.org:
On Sun, Nov 8, 2020 at 6:55 AM Jörg F. Wittenberger < Joerg.Wittenberger@softeyes.net> wrote:
(define (make-pipe) (open-u8vector-pipe '(buffering: #f) '(buffering: #f)))
This means that there is no buffering inside Gambit, which is almost always what you want.
That's been the intention.
(receive (in out) (make-pipe)
(display "foo" out) ;; I'd expect this to block, (force-output out) ;; but even this does not. "too bad")
The force-output has no effect because it flushes the Gambit buffers, but you have already disabled them.
That's been my - obviously wrong - assumption.
However, Posix pipes also have buffers inside, and you can write up to PIPE_BUF bytes atomically before you can be blocked. The value of PIPE_BUF depends on your OS, but on Linux it is 64K by default. This is actually harmless, though. Unlike a stdio buffer, as soon as there are any bytes in the pipe the receiving end can pull them out, so there is no need to ever flush the pipe itself.
Sure, I could get some flow control from putting a OS pipe in between. But that unreasonably complicates the (supposed to be portable) code.
My guess was that I might have overlooked something in the manual. Or the hope some would know how to mess with the internals to add it.