[gambit-list] Does gambit support flow control on ports?

John Cowan cowan at ccil.org
Sun Nov 8 21:10:31 EST 2020


On Sun, Nov 8, 2020 at 6:55 AM Jörg F. Wittenberger <
Joerg.Wittenberger at 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.

    (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.

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.



John Cowan          http://vrici.lojban.org/~cowan        cowan at ccil.org
"Repeat this until 'update-mounts -v' shows no updates.
You may well have to log in to particular machines, hunt down
people who still have processes running, and kill them."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20201108/f69c4968/attachment.htm>


More information about the Gambit-list mailing list