pitrou commented on code in PR #13635:
URL: https://github.com/apache/arrow/pull/13635#discussion_r924662599


##########
r/src/safe-call-into-r-impl.cpp:
##########
@@ -29,6 +37,58 @@ MainRThread& GetMainRThread() {
 // [[arrow::export]]
 void InitializeMainRThread() { GetMainRThread().Initialize(); }
 
+bool CanRunWithCapturedR() {
+#if defined(HAS_UNWIND_PROTECT)
+  static int on_old_windows = -1;
+  if (on_old_windows == -1) {
+    cpp11::function on_old_windows_fun = 
cpp11::package("arrow")["on_old_windows"];
+    on_old_windows = on_old_windows_fun();
+  }
+
+  return !on_old_windows;
+#else
+  return false;
+#endif
+}
+
+void SignalInterruptCondition() {
+#ifdef _WIN32
+  UserBreak = 1;
+  R_CheckUserInterrupt();
+#else
+  Rf_onintr();
+#endif
+}
+
+void OverridingSignalHandler(int sig) {
+  auto main_r_thread = GetMainRThread();

Review Comment:
   Is all this code really safe to execute from a signal handler (i.e. are all 
the APIs here reentrant)?
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to