I think the correct approach for R is to have a single global instance (or on the stack in main()) (e.g. [1]).
If your application is multi-threaded, what extra steps do you need to take? Does every call to the RInside object have to be protected by a mutex? Or, I wonder if some read-only accesses could be done in parallel? E.g. a data.frame has been created. Could 2+ threads access parts of that data.frame in parallel (as long as I'm sure no thread will update it)? I found [2], suggesting that this is okay for RServe. Implying it would be okay for RInside too? Darren [1]: http://stackoverflow.com/questions/5357765/passing-rinsides-r-instance-as-a-parameter-between-classes-methods [2]: http://www.rosuda.org/Rserve/ "Rserve is thread safe across connections, but eval methods are not thread safe within one connection. This means that multiple threads should not use the same connection unless they guarantee that no eval calls are run in parallel." -- Darren Cook, Software Researcher/Developer http://dcook.org/work/ (About me and my work) http://dcook.org/blogs.html (My blogs and articles) _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel