caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <gerd@gerd-stolpmann.de>
To: Eijiro Sumii <eijiro_sumii@anet.ne.jp>
Cc: caml-list@inria.fr, sumii@saul.cis.upenn.edu
Subject: Re: [Caml-list] select (or polling) on in_channel?
Date: Fri, 01 Apr 2005 12:59:24 +0200	[thread overview]
Message-ID: <1112353164.6180.10.camel@localhost.localdomain> (raw)
In-Reply-To: <20050331.182855.07449233.eijiro_sumii@anet.ne.jp>

Am Donnerstag, den 31.03.2005, 18:28 -0500 schrieb Eijiro Sumii:
> Hi again...
> 
> Is there any easy way to _correctly_ do a "select" (as in the UNIX
> system call) on Pervasives.in_channel?  My naive approach
> 
>   Unix.select [Unix.descr_of_in_channel ic] [] [] 0.
> 
> seems to fail (and it indeed does fail) because of the buffering
> inside Pervasives.in_channel, as long as I checked the source code of
> ocaml-3.08.3.  Pervasives.in_channel_length doesn't help in my case
> since the input channel is not a file.  Should I use only the
> low-level functions in the Unix module if I _ever_ want "select"?

Yes. The point is that you cannot interpret the result of Unix.select in
a reasonable manner. When Unix.select says the descriptor has no data,
it might still the case that there are data in the buffer. If the
descriptor has data, you don't know when they are exactly read into the
buffer.

I don't understand why you mention in_channel_length here. What is your
real problem?

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
------------------------------------------------------------



  reply	other threads:[~2005-04-01 10:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-31 23:28 Eijiro Sumii
2005-04-01 10:59 ` Gerd Stolpmann [this message]
2005-04-01 13:37   ` [Caml-list] " Eijiro Sumii
2005-04-03 14:43 ` Christoph Bauer
2005-04-04 20:24   ` Eijiro Sumii
2005-04-04 21:29     ` Eijiro Sumii
2005-04-05  5:49     ` Alex Baretta
2005-04-05 13:34       ` Eijiro Sumii
2005-04-05 14:14         ` Alex Baretta
2005-04-05 18:07           ` Eijiro Sumii
2005-04-05 14:30         ` Richard Jones
2005-04-05 18:12           ` Eijiro Sumii
2005-04-05  7:00 sejourne kevin
2005-04-05 13:39 ` Eijiro Sumii

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

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

  git send-email \
    --in-reply-to=1112353164.6180.10.camel@localhost.localdomain \
    --to=gerd@gerd-stolpmann.de \
    --cc=caml-list@inria.fr \
    --cc=eijiro_sumii@anet.ne.jp \
    --cc=sumii@saul.cis.upenn.edu \
    /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 NNTP newsgroup(s).