caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: xuzq <zuoqian@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Re: perl4caml crashed with threads
Date: Tue, 15 Nov 2005 11:52:30 +0000	[thread overview]
Message-ID: <20051115115229.GA25002@furbychan.cocan.org> (raw)
In-Reply-To: <loom.20051115T023040-429@post.gmane.org>

On Tue, Nov 15, 2005 at 02:03:20AM +0000, xuzq wrote:
> Yes,it 's ok without threads and i see perl4caml may not be
> thread-safe.I 'm only curious about why only "eval" crashes and
> "call" looks fine.In my program another thread run the following
> code without any error.

I'm guessing that 'call' works by luck.

I had a quick scan of the code and I can't see anything obviously
unsafe.  Since I never release the OCaml lock in any of the C code,
surely the C calls are all serialised?  It might also be that
perl4caml_init is being called twice (from two threads) which would
probably cause bad things to happen.  A simple print statement should
diagnose whether this is the case.

To be honest, I'm not sure what the threading issues are when calling
external C libraries.  I rarely even use threading in OCaml, and as
you probably guessed, I've never used it at all from perl4caml.

> Thank you for your excellent perl4caml,Richard!Would it be possible for perl
> to callocaml code just like the Inline::OCaml thoughts in that post:
> http://caml.inria.fr/pub/ml-archives/caml-list/2002/02/e363d76f1e9b94779b1ffe7de3a7c011.en.html?

Inline::OCaml would certainly be nice to have, but I don't have the
time, or possibly even the skills, to write it.

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com


      reply	other threads:[~2005-11-15 11:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-14  2:16 xuzq
2005-11-14 10:09 ` [Caml-list] " Richard Jones
2005-11-14 10:02   ` Florian Weimer
2005-11-15  2:03   ` xuzq
2005-11-15 11:52     ` Richard Jones [this message]

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=20051115115229.GA25002@furbychan.cocan.org \
    --to=rich@annexia.org \
    --cc=caml-list@inria.fr \
    --cc=zuoqian@gmail.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).