I have just tried to pipe all the messages to the main thread – the new
strategy is much easier to implement than I thought.
The new code works well. Indeed, as long as the Rprintf function is only called
by the main thread, it doesn’t matter how many worker threads are created.
From: Shian Su
Thanks Luke for clarifying that you should not call R API from outside the main
thread ever. There’s some false advice in
https://stackoverflow.com/questions/49723216/print-to-terminal-in-a-multithreaded-environment-for-cran-r-package
that suggests it’d be ok if you set up the right mutex.
I be