caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Chris Quinn <cq@htec.demon.co.uk>
Cc: CAML LIST <caml-list@inria.fr>
Subject: Re: [Caml-list] C callbacks and threading...
Date: Thu, 27 Sep 2001 15:20:18 +0200	[thread overview]
Message-ID: <20010927152018.A28468@pauillac.inria.fr> (raw)
In-Reply-To: <3BB2F29D.DA3E1C57@htec.demon.co.uk>; from cq@htec.demon.co.uk on Thu, Sep 27, 2001 at 10:34:21AM +0100

> The manual says a caml function can be registered and then used from
> the C runtime. Is this still true if called from a thread not
> created from within Caml ie. via the Thread module? I have vague
> recollections of caml's thread system involving some bookkeeping
> which probably rules this usage out.

It should work if:
- the Caml code doesn't use threads itself;
- you call it via callback_exn rather than callback (to make sure you
  always get control back from the Caml code);
- you protect the call to callback_exn by a mutex, to make sure that
  no two threads can call into Caml simultaneously.

In all other cases, and especially if the Caml code is multithreaded,
you would probably break something in the Caml runtime system.

- Xavier Leroy
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2001-09-27 13:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-27  9:34 Chris Quinn
2001-09-27 13:20 ` Xavier Leroy [this message]
2001-09-27 13:49   ` [Caml-list] Mac and C-code Ward Wheeler

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=20010927152018.A28468@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=cq@htec.demon.co.uk \
    /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).