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 0A1D7BC37 for ; Fri, 7 Aug 2009 12:07:11 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsCAN+Ze0pQW+UCe2dsb2JhbACaQgEBFiQEtGqEFgU X-IronPort-AV: E=Sophos;i="4.43,341,1246831200"; d="scan'208";a="30890724" 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 12:07:10 +0200 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MZMLs-0004Zq-UN for caml-list@inria.fr; Fri, 07 Aug 2009 10:07:08 +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 10:07:08 +0000 Received: from sylvain by ks300734.kimsufi.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Aug 2009 10:07:08 +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 10:06:59 +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 sockets:01 iter:01 printf:01 memq:01 ocaml:01 -thread:01 ocamlfind:01 -package:01 bug:01 ocaml:01 bug:01 non-ocaml:01 systhreads:01 Hello, On 07-08-2009, Christoph Bauer wrote: > >> 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 ? > > No! I try to clarify: > > my check is then > > match Unix.select sockets [] [] timeout with > | (l,_,_) -> > List.iter (fun sock -> printf "%b,%b\n" (List.mem sock > sockets) (List.memq sock sockets)) l > > I only use OCaml 3.11.0. It only happens on windows. > > If I compile and link with -thread and link with ocamlfind ... -package > threads > then the result is > > false,false > > But without the thread package the result is > > true,true > Maybe, I understand the bug. I use "lpOrig = (void *)fd;" where fd is an OCaml value (in select.c). Without thread and during the enter/leave_blocking_section(), there is less chance to trigger the GC and to modify "fd" value. This is the reason why it seems correct without thread and fall into a bug with thread. The obvious solution is to replace "lpOrig = (void *)fd" by a non-OCaml value (e.g. EMode + nth in ocaml list). Could you reduce your bug to the smallest possible program and submit the bug on OCaml bug tracking ? > > BTW, I use systhreads, but the files (scheduler.c, unix.ml) I mentioned > before are used in the vmthread case. > In otherlibs\systhreads\threadUnix.ml I found > > let select = Unix.select > This remains another bug (less important) since we cannot use -vmthreads, Unix.select and pipes on windows. Regards, Sylvain Le Gall