R-friendly threading in C++
