Skip to content
Prev 2223 / 10988 Next

[Rcpp-devel] Thread handling

Hi,

We kind of lost context of the original post, but:
On Tue, Apr 26, 2011 at 8:19 PM, Christian Gunning <xian at unm.edu> wrote:
Just to clarify the original intent -- the impression I got from the
OP is that he actually wanted to fire off a thread to run in the
background and have the user continue to use R while the background
process finishes, so ... he doesn't want R to wait for it to return.

I'm not an R-internals/plumbing guru, but if I had to guess, I'd say
that this is an "out of bounds" use case and I'm guessing will be
painful (impossible(?)) to get working as the OP intended ... I'd be
happy to be proven wrong, though.

I'm not sure what a suitable workaround would be -- I wonder if the
C(++) code you call down into can spawn a thread that then uses
RInside to fire up its own R process, configure it w/ the appropriate
vars/data, run the job in that single threaded R and just save the
results to some predertimed data file (not sure if that's the right
use case for RInside, either, I'm guessing) -- all the while control
will be returned to the users running R workspace.

At that point, though, maybe you'd just make a command line wrapper to
run your job from the shell and forget about invoking background
processes from within R altogether.

Just thinking out loud ..

-steve