Re: [Bioc-devel] Rprintf in a multi-threaded environment

2019-01-29 Thread Yang Liao
Thanks Martin and Luke, I think the only way to go is to only use the main thread to handle the screen output. -Original Message- From: Tierney, Luke Sent: Wednesday, 30 January 2019 1:16 AM To: Yang Liao Cc: bioc-devel@r-project.org Subject: Re: [Bioc-devel] Rprintf in a multi

Re: [Bioc-devel] Rprintf in a multi-threaded environment

2019-01-29 Thread Tierney, Luke
No functions in the R API are safe to call from any thread other than the R main thread. -- Many may need to allocate from the R heap (more as ALTREP evaolves) and that is not thread safe; -- Many (and with some compilation options nearly all) can signal an error, and the subsequent jump

Re: [Bioc-devel] Rprintf in a multi-threaded environment

2019-01-29 Thread Martin Morgan
Printing from multiple workers to stdout is problematic anyway, because the output from different workers is not intrinsically synchronized -- they will appear interleaved with each other. Generally for forked processes connections (to stdout, files, databases, urls, ...) need to be opened on t

[Bioc-devel] Rprintf in a multi-threaded environment

2019-01-28 Thread Yang Liao
Hi, I'm not sure if some C developers have gone through this problem: it seems that Rprintf cannot work safely in a multi-threaded environment. In particular, if I call Rprintf() from a then-created thread while the stack size checking is enabled (ie the "R_CStackLimit" pointer isn't set to -1)