> 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.

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.

Best,

Daniel

_______________________________________________
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

Reply via email to