<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2002/07/3ed4479b8b1cc90b06bab8bccf459041"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-25T09:08:02"
  subject="Re: [Caml-list] native threads, connect"
  prev="2002/07/40e2f56597bf7b312228013855c99b31"
  next="2002/07/23b94851b6de87ec4685ec6f3ce9b873"
  prev-in-thread="2002/07/9c5db8b4fa5d55db5af454a33fbf62e4"
  prev-thread="2002/07/b81cd91ca5c58fb4385124e4ce5919e8"
  next-thread="2002/07/95de666352c0f6a57db385835c3792d1"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] native threads, connect">
<msg 
  url="2002/07/9c5db8b4fa5d55db5af454a33fbf62e4"
  from="Francois Rouaix &lt;francois@r...&gt;"
  author="Francois Rouaix"
  date="2002-07-23T20:09:42"
  subject="[Caml-list] native threads, connect">
<msg 
  url="2002/07/3ed4479b8b1cc90b06bab8bccf459041"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-25T09:08:02"
  subject="Re: [Caml-list] native threads, connect">
</msg>
</msg>
</thread>

<contents>
Hi François,

&gt; I'm upgrading some very old network code of mine to Ocaml 3.05,
&gt; and I'm getting confused about the behavior of connect() in 
&gt; bytecode threads vs. native threads. 
&gt; As you know, to get a yieldable connect, you put a socket
&gt; in non-blocking mode, connect, and wait for the socket to
&gt; be writable. That is how connect is written in
&gt; otherlibs/threads/unix.ml.
&gt; Now on the other hand otherlibs/systhreads does not 
&gt; 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.

&gt; Which unix.ml is used when compiling with -threads with
&gt; bytecode and native compilers (with Ocaml configured in native
&gt; 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

</contents>

</message>

