caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jonathan Roewen" <jonathan.roewen@gmail.com>
To: "Trevor Jim" <trevor@research.att.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] effect of -thread with ocamlc/ocamlopt -c
Date: Wed, 13 Sep 2006 09:34:57 +1200	[thread overview]
Message-ID: <ad8cfe7e0609121434o1a6f152r512fb1ca9355a173@mail.gmail.com> (raw)
In-Reply-To: <4506E954.8080207@research.att.com>

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 <trevor@research.att.com> 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
>


  parent reply	other threads:[~2006-09-12 21:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-12 17:07 Trevor Jim
2006-09-12 21:29 ` [Caml-list] " Jonathan Roewen
2006-09-12 21:34 ` Jonathan Roewen [this message]
2006-09-13 14:59   ` Trevor Jim
2006-09-13 16:34     ` Jacques Garrigue
2006-09-13 16:57       ` Trevor Jim
2006-09-13 17:40       ` Xavier Leroy

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=ad8cfe7e0609121434o1a6f152r512fb1ca9355a173@mail.gmail.com \
    --to=jonathan.roewen@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=trevor@research.att.com \
    /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).