Hi Andy, Andy Wingo <wi...@igalia.com> skribis:
> On Thu 22 Jun 2017 18:05, ludovic.cour...@inria.fr (Ludovic Courtès) writes: > >> Andy Wingo <wi...@igalia.com> skribis: >> >>> Why not just set to _IOFBF and let Guile 2.2's buffering handle it? >> >> Because we want controlled buffering when writing (we need to flush >> pending output when we’re done writing the RPC request), and no >> buffering at all when reading. > > For controlling output buffering, there is the setvbuf buffer size, and > "force-output". In Guile 2.2 the CBOP's "write" function is really a > "flush" function -- it only gets called when the internal buffer is > filled, or when flush-output is called, or (for line-buffered ports) > when a newline is written. > > Why do you not want buffering when reading? Do you need to hand off > this FD to some other process? With the current protocol, often we’re just reading a handful of bytes. Full buffering would mean that Guile would block on an 8K read or so that will never be fulfilled. Ludo’.