From zhengda1936 at gmail.com  Sun Feb  1 00:30:03 2015
From: zhengda1936 at gmail.com (Zheng Da)
Date: Sat, 31 Jan 2015 18:30:03 -0500
Subject: [Rd] invoking R function in C++ in parallel
Message-ID: <CAFLer83nzRs1cV7Cpu7VWUEDrqaSC7kjrUBbMUHzaFAp97DQGA@mail.gmail.com>

Hello,

I'm writing an R extension in C++. In the extension, I want to invoke
an R function directly and it works when I use Rcpp in the serial
code. But what I really want is to invoke the R function in parallel
with openmp. When I do so, I got segmentation fault.

I remember someone said that R isn't thread-safe. I think it's also
understandable because an R function also has environment variables.

My question is:
Can we make a copy of an R function (including its environment
variables) for each thread?
Are there any ways to invoke an R function in C/C++ in multiple threads safely?

Thanks,
Da



[Rd] invoking R function in C++ in parallel
Zheng Da