Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Xavier Leroy <xavier.leroy@inria.fr>
To: Basile STARYNKEVITCH <basile.starynkevitch@cea.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] nonblocking I/O - using channels or Unix.file_descr ?
Date: Fri, 28 Jun 2002 15:34:38 +0200	[thread overview]
Message-ID: <20020628153438.A20730@pauillac.inria.fr> (raw)
In-Reply-To: <15644.24855.239460.616880@is002254.saclay.cea.fr>; from basile.starynkevitch@cea.fr on Fri, Jun 28, 2002 at 03:13:59PM +0200

> 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

Yes -- the bytecode thread library does just that.
Be prepared to handle the Sys_blocked_io exception that will be raised
by Pervasives I/O functions when they cannot complete without
blocking.

- Xavier Leroy
-------------------
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


      reply	other threads:[~2002-06-28 13:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-28 13:13 Basile STARYNKEVITCH
2002-06-28 13:34 ` Xavier Leroy [this message]

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=20020628153438.A20730@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=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