From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA20886; Fri, 28 Jun 2002 15:14:19 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA20638 for ; Fri, 28 Jun 2002 15:14:18 +0200 (MET DST) Received: from cirse.saclay.cea.fr (cirse.saclay.cea.fr [132.166.192.127]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g5SDEHf29037 for ; Fri, 28 Jun 2002 15:14:17 +0200 (MET DST) Received: from argiope.saclay.cea.fr (argiope.saclay.cea.fr [132.166.192.108]) by cirse.saclay.cea.fr (8.12.2/8.12.2/CEAnet-Internet.1.0) with ESMTP id g5SDEHZj029204 for ; Fri, 28 Jun 2002 15:14:17 +0200 (MEST) Received: from muguet.saclay.cea.fr (unverified) by argiope.saclay.cea.fr (Content Technologies SMTPRS 4.2.10) with ESMTP id for ; Fri, 28 Jun 2002 15:07:47 +0200 Received: from is002254.saclay.cea.fr (is002254.saclay.cea.fr [132.166.134.67]) by muguet.saclay.cea.fr (8.12.2/8.12.2/CEAnet-Interne.1.0) with ESMTP id g5SDEGC7003424; Fri, 28 Jun 2002 15:14:17 +0200 (MEST) Received: from basile by is002254.saclay.cea.fr with local (Exim 3.35 #1 (Debian)) id 17NvZY-0000Mc-00; Fri, 28 Jun 2002 15:14:00 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <15644.24855.239460.616880@is002254.saclay.cea.fr> Date: Fri, 28 Jun 2002 15:13:59 +0200 To: caml-list@inria.fr Subject: [Caml-list] nonblocking I/O - using channels or Unix.file_descr ? X-Mailer: VM 7.03 under Emacs 21.2.1 From: Basile STARYNKEVITCH Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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