Provides R-friendly threading functionality:
checkUserInterrupt() and Rcout,std::thread,The library is header-only, platform-independent, and only requires a C++11-compatible compiler.
For a detailed description of its functionality and examples, see the vignette or the API documentation.
Release version from CRAN:
Latest development version from github:
Pass "RcppThread" to the depends argument and "cpp11" to the plugins argument. For example:
Rcpp::cppFunction('void func() { /* actual code here */ }',
depends = "RcppThread", plugins = "cpp11")Add
before including any headers in your source code.
CXX_STD = CXX11 to the src/Makevars(.win) files of your package.RcppThread to the LinkingTo field of your DESCRIPTION file.std::cout and std::threadThere are preprocessor options to replace all occurences of std::cout and std::thread with calls to RcppThread::Rcout and RcppThread::Thread (provided that the RcppThread headers are included first). To enable this, use
#define RCPPTHREAD_OVERRIDE_COUT 1 // std::cout override
#define RCPPTHREAD_OVERRIDE_THREAD 1 // std::thread override
before including the RcppThread headers.