caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sylvain Le Gall <sylvain@le-gall.net>
To: caml-list@inria.fr
Subject: Re: windows, threads and sockets
Date: Fri, 7 Aug 2009 08:39:21 +0000 (UTC)	[thread overview]
Message-ID: <slrnh7nq1p.rtu.sylvain@gallu.homelinux.org> (raw)
In-Reply-To: <BB046CA812535C45BD0029AA9D04BA7906700DD7@KL-SRV57.lmsintl.com>

On 07-08-2009, Christoph Bauer <christoph.bauer@lmsintl.com> wrote:
> Hi,
>
> 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).
>

Do you mean that the following code is wrong with 3.11.1 and not 3.10.2:

let res_listener = Unix.select listOfSockets [] [] timeout
in
(List.nth res_listener 0) = listenSocket

Can you find listenSocket in the result elsewhere ?

Regards,
Sylvain Le Gall


  parent reply	other threads:[~2009-08-07  8:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07  7:43 Christoph Bauer
2009-08-07  7:54 ` [Caml-list] " David Allsopp
2009-08-07  8:17   ` Christoph Bauer
2009-08-07  8:34     ` Sylvain Le Gall
2009-08-07  8:39 ` Sylvain Le Gall [this message]
2009-08-07  9:30   ` [Caml-list] " Christoph Bauer
2009-08-07 10:06     ` Sylvain Le Gall
2009-08-07 10:55       ` [Caml-list] " Christoph Bauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=slrnh7nq1p.rtu.sylvain@gallu.homelinux.org \
    --to=sylvain@le-gall.net \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).