[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add a `read' method for ports

From: Ludovic Courtès
Subject: Re: [PATCH] Add a `read' method for ports
Date: Mon, 09 Jun 2008 22:59:45 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Hi Neil,

"Neil Jerram" <address@hidden> writes:

> Sorry for not commenting before...  I've reviewed the history, and
> started looking through the patches, and I'm feeling (possibly)
> confused.  Am I correct in thinking that the "problem" here (which you
> are aiming to solve) only affects unbuffered ports?

Yes, such as sockets.

> If that's right, I'm not clear why the solution is involving so much
> restructuring - can't it be done without introducing the new "read"
> field?

I don't think so.  Currently, when asking for N bytes at the application
level, e.g., via `uniform-vector-read!' or `scm_c_read ()', we end up
going through a series of `scm_fill_input ()'.  For unbuffered ports,
this translates into N `scm_fill_input ()', and for unbuffered file
ports, into N one-byte `read(2)' calls.

IOW, the information about how many bytes are requested by the
application isn't currently transferred to port implementations.  This
is what the `read' method aims to solve.

The `read' method also has the advantage that it doesn't need to fiddle
with `port->read_buf', unlike `fill_input' (but one still has to deal
with it when instantiating a port).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]