English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
windows, threads and sockets
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-08-07 (07:43)
From: Christoph Bauer <christoph.bauer@l...>
Subject: windows, threads and sockets

I'm using OCaml 3.11.0. My question is about my program,
which used to work fine under windows and linux. The program
is a daemon, which waits for socket connections and respondse
to queries.

Now I added an extension with uses threads. Everything is
find on linux, but I have a very strange behaviour on windows.
For the troubles it is sufficient to link agains threads and compile the
main program with -thread. Without it everything is fine again.

I'm not quite sure what is going on, but my best bet is this: the main
loop waits for the sockets with

Unix.select listOfSockets [] [] timeout

One socket is the listener socket on which new connections 
are made. Unix.select returns a list of sockets. Initially
it must be the listener socket. This is checked with a compare

  socket = listenSocket 

and this seems to be suddenly wrong (just in the thread case).

Any ideas?


Christoph Bauer