From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_FAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 1D770BC37 for ; Fri, 7 Aug 2009 10:40:08 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsCAMeEe0pQW+UCe2dsb2JhbACaQQEBFiQEtHiEFgU X-IronPort-AV: E=Sophos;i="4.43,340,1246831200"; d="scan'208";a="30886773" Received: from main.gmane.org (HELO ciao.gmane.org) ([80.91.229.2]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 07 Aug 2009 10:40:07 +0200 Received: from root by ciao.gmane.org with local (Exim 4.43) id 1MZKza-0000X2-Vs for caml-list@inria.fr; Fri, 07 Aug 2009 08:40:03 +0000 Received: from ks300734.kimsufi.com ([91.121.65.225]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Aug 2009 08:40:02 +0000 Received: from sylvain by ks300734.kimsufi.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Aug 2009 08:40:02 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Sylvain Le Gall Subject: Re: windows, threads and sockets Date: Fri, 7 Aug 2009 08:39:21 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ks300734.kimsufi.com User-Agent: slrn/pre1.0.0-2 (Linux) Sender: news X-Spam: no; 0.00; le-gall:01 sockets:01 ocaml:01 -thread:01 sockets:01 threads:01 threads:01 wrote:01 unix:01 unix:01 compile:01 behaviour:01 seems:03 let:03 christoph:04 On 07-08-2009, Christoph Bauer 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