paleolimbot commented on code in PR #13397:
URL: https://github.com/apache/arrow/pull/13397#discussion_r918455500


##########
r/src/safe-call-into-r.h:
##########
@@ -93,7 +100,8 @@ MainRThread& GetMainRThread();
 // a SEXP (use cpp11::as_cpp<T> to convert it to a C++ type inside
 // `fun`).
 template <typename T>
-arrow::Future<T> SafeCallIntoRAsync(std::function<arrow::Result<T>(void)> fun) 
{
+arrow::Future<T> SafeCallIntoRAsync(std::function<arrow::Result<T>(void)> fun,
+                                    std::string reason = "unspecified") {

Review Comment:
   > But then SafeCallIntoR should not be called directly?
   
   There is a mechanism in SafeCallIntoR that won't attempt execution if the 
main R thread has an error registered (returning an error status). As I 
understand it, we can't attempt to execute on the main R thread until we 
terminate anything running in the background, are back on the main R thread, 
and can `throw cpp11::unwind_exception()`.
   
   I tried to unify the two approaches but I get errors on 32-bit Windows + R 
3.6. I think the approach can be simplified a little and made safer although 
perhaps ARROW-11841 would be a good ticket to use for that since it will 
probably need more changes to this bit of code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to