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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 3DB14BC0B for ; Thu, 25 Jan 2007 16:34:23 +0100 (CET) Received: from orion.metastack.com (no-dns-yet.demon.co.uk [80.177.38.218] (may be forged)) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0PFYP1L014245 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 25 Jan 2007 16:34:26 +0100 Received: from treble (cpc2-cmbg6-0-0-cust535.cmbg.cable.ntl.com [81.107.34.24]) (authenticated bits=0) by orion.metastack.com (8.13.4/8.13.3) with ESMTP id l0PEpdU8017665 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Thu, 25 Jan 2007 14:51:40 GMT From: "David Allsopp" To: "'OCaml List'" References: <003501c74077$6785db20$6a7ba8c0@treble> <1169736821.5807.19.camel@rosella.wigram> Subject: RE: [Caml-list] Win32 Services & O'Caml Date: Thu, 25 Jan 2007 15:35:01 -0000 Organization: MetaStack Solutions Ltd. Message-ID: <006201c74096$611078d0$6a7ba8c0@treble> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Thread-Index: AcdAiqdPxcMOpnLXSPKRwZ+/94jMNQABqbfA In-Reply-To: <1169736821.5807.19.camel@rosella.wigram> X-Miltered: at concorde with ID 45B8CE01.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; o'caml:01 threads:01 o'caml:01 terminating:01 ocaml:01 ocaml:01 threading:01 threads:01 pointer:01 heap:01 heap:01 sourceforge:01 wrote:01 caml-list:01 caml-list:01 I agree --- although, unless my understanding of how Win32 does it is completely wrong, I don't think there are any non-O'Caml threads in use. StartServiceCtrlDispatcher is invoked by an O'Caml created thread and it doesn't return until the very end of the service (i.e. when the service has been totally shutdown and the process is terminating). However, what's not clear to me is whether there are implications of an O'Caml function calling a C-function which calls back to another C-function which subsequently calls back to O'Caml!! David -----Original Message----- From: skaller [mailto:skaller@users.sourceforge.net] Sent: 25 January 2007 14:54 To: David Allsopp Cc: OCaml List Subject: Re: [Caml-list] Win32 Services & O'Caml On Thu, 2007-01-25 at 11:53 +0000, David Allsopp wrote: > Yesterday I completed a module that allows construction of Win32 Services in > O'Caml. Non-threaded O'Caml apps seem to be working just fine but I've hit a > brick wall with multi-threaded applications. I'm sure Xavier will fix my misconceptions here, but I suspect the requirement is that Ocaml threading library must start the threads so it can arrange for state to be properly shared, in particular the heap. If other code starts the thread, when it makes a callback into Ocaml, Ocaml can't find the shared state because it was never established. Any system (not just Ocaml) is going to have this problem if it uses an environment not strictly conforming to that provided natively. EG .. how do you share a young heap pointer held in an AMD64 machine register across threads .. when the OS carefully makes sure registers are not shared?? :) -- John Skaller Felix, successor to C++: http://felix.sf.net