From: David Allsopp <dra-news@metastack.com>
To: "OCaml List (caml-list@inria.fr)" <caml-list@inria.fr>
Subject: RE: [Caml-list] C function calls OCaml function in multithreads
Date: Mon, 9 Mar 2015 09:43:10 +0000 [thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9E998A6E9@Remus.metastack.local> (raw)
In-Reply-To: <CALk-pjOuxsF2h69fFOyyhwO9-8AOJjXen=MtCPhD3=UQ0w7SPw@mail.gmail.com>
Masateru Kawaguchi wrote:
> David Allsopp wrote:
> > Chapter 19 of the manual? Especially sections 10 "Advanced topics: multithreading"
> > (http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#sec465) and 7 "Advanced topics:
> > callbacks from C to OCaml" (http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#sec448
> > - see in particular 19.7.4)
>
> Thank you for your answer.
> I've read the manual. That's what I'd like to know.
Forgive the confusion, but 19.10 of the manual *is* the answer to your question: it describes exactly what you have to do for multiple C threads which to make calls into the OCaml runtime. You need to use caml_c_thread_register/caml_c_thread_unregister and caml_release_runtime_system/caml_acquire_runtime_system. You don't need your own mutex - OCaml already has its own "master lock", as described.
David
prev parent reply other threads:[~2015-03-09 9:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-05 2:31 Masateru Kawaguchi
2015-03-09 1:31 ` Masateru Kawaguchi
2015-03-09 7:36 ` David Allsopp
2015-03-09 9:21 ` Masateru Kawaguchi
2015-03-09 9:43 ` David Allsopp [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=E51C5B015DBD1348A1D85763337FB6D9E998A6E9@Remus.metastack.local \
--to=dra-news@metastack.com \
--cc=caml-list@inria.fr \
/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