caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Guillaume Yziquel <guillaume.yziquel@citycable.ch>
To: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
Cc: caml-list List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] problem creating .cma library
Date: Mon, 11 Jan 2010 18:14:57 +0100	[thread overview]
Message-ID: <4B4B5C91.2040206@citycable.ch> (raw)
In-Reply-To: <91a3da521001091811n6a972e84l3dfcae92f4dfae93@mail.gmail.com>

Daniel Bünzli a écrit :
>> So if I want to call R code that multithreads with OCaml, I should write
>> something like
>>
>>>  enter_blocking_section();
>>>  PROTECT(e = R_tryEval(Sexp_val(sexp_list), R_GlobalEnv, &error));
>>>  UNPROTECT(1);
>>>  leave_blocking_section();
>> Am I correct?
> 
> Yes, but the functions have now a caml_ prefix.
> 
> Make sure that there is no interaction whatsoever with ocaml's runtime
> system (e.g. ocaml value allocation) between the two calls.

I will have interaction, because I plan to be able to make R call OCaml 
code (not in the foreseeable future). But it's just a question of 
wrapping the call back to Ocaml with a

	caml_leave_blocking_section()
	callingOCamlcode()
	caml_enter_blocking_section()

construct. As far as I've understood.

> Note also that in case you need to use some caml value after the leave
> call you have to declare it with a CAMLparam macro as it may move
> during the blocking section even if the stub itself doesn't allocate.

Very helpful. Thanks a lot.

-- 
      Guillaume Yziquel
http://yziquel.homelinux.org/


  reply	other threads:[~2010-01-11 17:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-30 17:48 rouanvd
2009-12-30 23:30 ` [Caml-list] " Guillaume Yziquel
2010-01-05 13:04   ` Damien Doligez
2010-01-08 23:38     ` Guillaume Yziquel
2010-01-08 23:54       ` Basile STARYNKEVITCH
2010-01-09  0:11         ` Guillaume Yziquel
2010-01-09  7:58           ` David Allsopp
2010-01-09 11:33             ` Guillaume Yziquel
2010-01-09 12:52               ` Richard Jones
2010-01-09 14:00                 ` Daniel Bünzli
2010-01-09 14:02                   ` Daniel Bünzli
2010-01-09 14:21                     ` Joel Reymont
2010-01-09 19:36                   ` Guillaume Yziquel
2010-01-10  2:11                     ` Daniel Bünzli
2010-01-11 17:14                       ` Guillaume Yziquel [this message]
2010-01-10 13:31                     ` ygrek
2010-01-11 18:01                       ` Guillaume Yziquel
2010-01-09 19:29                 ` Guillaume Yziquel
2010-01-11 12:18                   ` Gerd Stolpmann
2010-01-11 17:11                     ` Guillaume Yziquel
2010-01-20 14:42                   ` Damien Doligez

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=4B4B5C91.2040206@citycable.ch \
    --to=guillaume.yziquel@citycable.ch \
    --cc=caml-list@yquem.inria.fr \
    --cc=daniel.buenzli@erratique.ch \
    /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).