Version française
Home     About     Download     Resources     Contact us    
Browse thread
select (or polling) on in_channel?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eijiro Sumii <eijiro_sumii@a...>
Subject: select (or polling) on in_channel?
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"?

Thanks,

--
Eijiro Sumii (http://www.cis.upenn.edu/~sumii/)
Department of Computer and Information Science, University of Pennsylvania