From: Basile STARYNKEVITCH <basile.starynkevitch@cea.fr>
To: caml-list@inria.fr
Subject: [Caml-list] nonblocking I/O - using channels or Unix.file_descr ?
Date: Fri, 28 Jun 2002 15:13:59 +0200 [thread overview]
Message-ID: <15644.24855.239460.616880@is002254.saclay.cea.fr> (raw)
Dear All,
I want to code nonblocking IO on Linux (I am not concerned with
"portability" problems to non-unix system). Of course I will use
Unix.select to wait for availability of input and output. (I do not
want to use multithreading here because I might have several dozens of such
I/O "ports" thru Unix named FIFOs).
Can I use Pervasives channels and then
Unix.set_nonblock (Unix.descr_of_in_channel myinchan)
Unix.set_nonblock (Unix.descr_of_out_channel myoutchan)
and then read & write bytes with
Pervasives.input myinchan buf pos len
Pervasives.output myoutchan buf pos len
or should I do the buffering explicitly myself using only Unix.read
and Unix.write
Apparently, the code in ocaml/byterun/io.c (notably the do_read and
do_write internal functions there) seems to be able to deal with
nonblocking channels, but I am not fully sure of this.
Regards
--
N.B. Any opinions expressed here are only mine, and not of my organization.
N.B. Les opinions exprimees ici me sont personnelles et n engagent pas le CEA.
---------------------------------------------------------------------
Basile STARYNKEVITCH ---- Commissariat à l Energie Atomique * France
DRT/LIST/DTSI/SLA * CEA/Saclay b.528 (p111f) * 91191 GIF/YVETTE CEDEX
phone:+33 1,6908.6055; fax: 1,6908.8395 home: 1,4665.4553; mobile: 6,8501.2359
work email: Basile point Starynkevitch at cea point fr
home email: Basile at Starynkevitch point net
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next reply other threads:[~2002-06-28 13:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-28 13:13 Basile STARYNKEVITCH [this message]
2002-06-28 13:34 ` Xavier Leroy
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=15644.24855.239460.616880@is002254.saclay.cea.fr \
--to=basile.starynkevitch@cea.fr \
--cc=caml-list@inria.fr \
/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