[Rcpp-devel] RInside and multi-threading
Dirk Eddelbuettel
edd at debian.org
Sun Feb 12 04:32:09 CET 2012
On 12 February 2012 at 11:47, Darren Cook wrote:
| 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?
"In theory, theory and practice are the same. In practice, they are not."
At present, Rserve is set up to fork (on OS X and Linux). Whereas RInside is
not (yet). Patches are always welcome.
Dirk
| 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 at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
--
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx
More information about the Rcpp-devel
mailing list