[Rcpp-devel] Rcpp::exception + threads = disaster
JJ Allaire
jj.allaire at gmail.com
Sat Feb 8 21:47:49 CET 2020
On Sat, Feb 8, 2020 at 3:45 PM Joshua N Pritikin <jpritikin at pobox.com>
wrote:
> On Sat, Feb 08, 2020 at 03:28:22PM -0500, JJ Allaire wrote:
> > Agreed that it would be good to have more clear docs here. Note
> > that as Dirk pointed out both Writing R Extensions and
> > RcppParallel docs are pretty clear about the fact that you
> > shouldn't call any R APIs when in a background thread.
>
> Rcpp::stop superficially looks like a nice way to throw C++ exceptions
> that also does printf style message formatting. I didn't realize that
> it calls R APIs until I looked at the implementation.
>
That's a good point, I had forgotten about the printf stuff which is a good
reason to prefer it to "regular" exceptions.
> Sure, but does it *have* to be that way? It seems to me that
> exceptions.h line 40,
>
> rcpp_set_stack_trace(Shield<SEXP>(stack_trace()))
>
Not sure about whether this is indeed a mandatory constraint (I didn't work
on the stack trace bit).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20200208/d2093434/attachment.html>
More information about the Rcpp-devel
mailing list