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 LAA23238; Thu, 25 Jul 2002 11:08:02 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA23222 for ; Thu, 25 Jul 2002 11:08:02 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g6P97vT12490; Thu, 25 Jul 2002 11:07:57 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA23234; Thu, 25 Jul 2002 11:07:56 +0200 (MET DST) Date: Thu, 25 Jul 2002 11:07:56 +0200 From: Xavier Leroy To: Francois Rouaix Cc: caml-list@inria.fr Subject: Re: [Caml-list] native threads, connect Message-ID: <20020725110756.A22996@pauillac.inria.fr> References: <000e01c23011$4a0c1bc0$ca01a8c0@homebox> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 1.0i In-Reply-To: <000e01c23011$4a0c1bc0$ca01a8c0@homebox>; from francois@rouaix.org on Sat, Jul 20, 2002 at 10:17:11AM -0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi François, > I'm upgrading some very old network code of mine to Ocaml 3.05, > and I'm getting confused about the behavior of connect() in > bytecode threads vs. native threads. > As you know, to get a yieldable connect, you put a socket > in non-blocking mode, connect, and wait for the socket to > be writable. That is how connect is written in > otherlibs/threads/unix.ml. > Now on the other hand otherlibs/systhreads does not > have a specific unix.ml that defines a connect(). With POSIX or Win32 threads, connect() blocks the calling thread but not the other threads. So, Caml just goes ahead and calls connect(). The trick you mention with non-blocking sockets is just a way to emulate this behavior (block the calling thread but not the other threads) when system threads are not used and scheduling is performed at the bytecode level. > Which unix.ml is used when compiling with -threads with > bytecode and native compilers (with Ocaml configured in native > threads)? The one in otherlibs/unix in the source distribution. Hope this helps, - Xavier ------------------- 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