unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Kevin Ryde <user42@zip.com.au>
To: Guile-Devel <guile-devel@gnu.org>
Subject: Re: Unbuffered socket I/O
Date: Tue, 27 Feb 2007 10:27:07 +1100	[thread overview]
Message-ID: <87slcsfqk4.fsf@zip.com.au> (raw)
In-Reply-To: <877iu59fm8.fsf@laas.fr> (Ludovic Courtès's message of "Mon, 26 Feb 2007 15:07:43 +0100")

ludovic.courtes@laas.fr (Ludovic Courtès) writes:
>
> Right.  That's an incompatible change if the _output_ is buffered.
> Input can be buffered, though, without this being visible by users.

Alas, that too is in an incompatible change, because recv! ignores
buffering.

> Fortunately, port buffering doesn't have to be symmetrical (although the
> API allowing to do that is internal---actually, we might want to expose
> and document `scm_fport_buffer_add ()').

Sounds good.  Perhaps `setvbuf-input' and `setvbuf-output' for the two
directions.  They could go in 1.8 too if you're careful with the
implementation.

Might have to check the SCM_BUFLINE and SCM_BUF0 flags are ok though.
Suspect the answer is yes, SCM_BUFLINE being an output side feature,
and SCM_BUF0 already merely a combination read==unbuf + write==unbuf.

> Thus, I propose the following
> change, where sockets are turned into ports whose output is left
> unbuffered and whose input is buffered.

The manual could emphasise that unbuffered is not what you want if
reading piecemeal, but the default should stay as advertised.

> BTW, do you know what the purpose of `fport_wait_for_input ()' is?

Maybe left from the 1.6 cooperative threads.

> It
> does nothing for O_NONBLOCK streams and waits for events otherwise.
> Since, for blocking streams, `read ()' does not return until either EOF
> is reached or at least one octet was read, `fport_wait_for_input ()'
> seems redundant.

Ahh, hang on, I wonder if it's a hack to do an "exit guile" while
blocked within a read(), thus allowing gc to run in other threads.

If that's true then presumably the write side is afflicted too, as
well as various other potentially blocking operations like
read-string!/partial and gethost.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


  parent reply	other threads:[~2007-02-26 23:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23 17:09 Unbuffered socket I/O Ludovic Courtès
2007-02-23 22:36 ` Neil Jerram
2007-02-25 22:57 ` Kevin Ryde
2007-02-26 14:07   ` Ludovic Courtès
2007-02-26 20:32     ` Neil Jerram
2007-02-26 23:35       ` Kevin Ryde
2007-02-27  9:11       ` Ludovic Courtès
2007-02-28 21:24         ` Kevin Ryde
2007-03-01  9:10           ` Ludovic Courtès
2007-03-04 23:48             ` Kevin Ryde
2007-03-07  0:20             ` Kevin Ryde
2007-03-07  0:30             ` Kevin Ryde
2007-03-07  4:45               ` Kevin Ryde
2007-03-07  9:40               ` Ludovic Courtès
2007-02-26 23:27     ` Kevin Ryde [this message]
2007-02-28  9:47       ` Ludovic Courtès
2007-02-28 20:59         ` Kevin Ryde
2007-03-01 10:44           ` Ludovic Courtès
2007-03-05 23:15             ` Kevin Ryde
2007-08-07 16:01               ` Ludovic Courtès
2007-05-13 17:13       ` `scm_std_select ()' call in `fport_wait_for_input ()' Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87slcsfqk4.fsf@zip.com.au \
    --to=user42@zip.com.au \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).