caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] native threads, connect
@ 2002-07-20 17:17 Francois Rouaix
  2002-07-25  9:07 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Francois Rouaix @ 2002-07-20 17:17 UTC (permalink / raw)
  To: caml-list

Hi all,
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().

Which unix.ml is used when compiling with -threads with
bytecode and native compilers (with Ocaml configured in native
threads)?

--f
-------------------
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] native threads, connect
  2002-07-20 17:17 [Caml-list] native threads, connect Francois Rouaix
@ 2002-07-25  9:07 ` Xavier Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 2002-07-25  9:07 UTC (permalink / raw)
  To: Francois Rouaix; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-25  9:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-20 17:17 [Caml-list] native threads, connect Francois Rouaix
2002-07-25  9:07 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).