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.7 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 55797BC4E for ; Tue, 12 Sep 2006 23:35:02 +0200 (CEST) Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.226]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k8CLZ10L008967 for ; Tue, 12 Sep 2006 23:35:01 +0200 Received: by wx-out-0506.google.com with SMTP id s6so2350361wxc for ; Tue, 12 Sep 2006 14:34:57 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Ll+I85ar3y/gZAuNf5anKKrOkc2ZkEbFVh76XKONtawZrhfBTjAKLbFLeI8D3R+RrumYQiDbIc01C2plIsU0t+UkhIclmbzrymT9SJh66f8ZiaBXuCv8+3O8OTDs/eWCkjl0vHGh6QiihhuY3hQdcWBjeTjThN99hbE3VvW3x/8= Received: by 10.70.109.6 with SMTP id h6mr9086111wxc; Tue, 12 Sep 2006 14:34:57 -0700 (PDT) Received: by 10.70.84.13 with HTTP; Tue, 12 Sep 2006 14:34:57 -0700 (PDT) Message-ID: Date: Wed, 13 Sep 2006 09:34:57 +1200 From: "Jonathan Roewen" To: "Trevor Jim" Subject: Re: [Caml-list] effect of -thread with ocamlc/ocamlopt -c Cc: caml-list@yquem.inria.fr In-Reply-To: <4506E954.8080207@research.att.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4506E954.8080207@research.att.com> X-j-chkmail-Score: MSGID : 45072805.000 on discorde : j-chkmail score : X : 0/20 1 X-Miltered: at discorde with ID 45072805.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; -thread:01 ocamlc:01 ocamlopt:01 pervasives:01 internals:01 pervasives:01 threading:01 -thread:01 ocamlc:01 ocamlopt:01 binary:01 cmo:01 cmx:01 threads:01 threads:01 Oh wait, I'm sorry. Yes, there is good reason: it uses a different version of Pervasives internals. Depending on when linking is done for each part, you may end up with conflicting implementations of Pervasives in your final program: so [IO] operations that can block will block whole program instead of running thread blocking, and another thread running instead. So maybe if it uses no IO, and no threading functions, it might be okay -- there are no guarantees when you do these sorts of things (: Jonathan On 9/13/06, Trevor Jim wrote: > I have a question about the effect of -thread when used > with ocamlc/ocamlopt -c. > > The manual states: > > All object files on the command line must also have been compiled > with the -thread option > > However, in compiling a large number of files I have not yet found a > case where -thread made a difference in the output of ocamlc or > ocamlopt (provided of course that module Thread is not used). In > other words, the binary output is identical. > > So, in general, can I take a .cmo or .cmx file that was NOT compiled > with -thread and link it with the threads library threads.cma or > threads.cmxa? > > And, in general, can I take a .cmo or .cmx file that WAS compiled with > -thread but which does not use module Thread, and link it into a > program without the threads library? > > > Here's why this matters to me. I have a large app (galax, with 300+ > modules) that started out unthreaded. I have added a threaded server, > which extends the app with one file that uses the Thread module. So I > have a server that needs to be threaded, plus all the old programs > (galax compiler, etc.) that don't need to be threaded. Linking in the > threads library causes the programs that don't use or need threads to > slow down by 2-30 times. > > Since the program is so large, I would prefer not to have to compile > each module twice, once with threads and once without. > > Also, it relies on a large number of libraries. I don't want to have > to have two versions of each library. > > But the manual seems to imply that I need to do that. > > -Trevor > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >