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


##########
r/src/safe-call-into-r-impl.cpp:
##########
@@ -42,43 +57,40 @@ bool CanRunWithCapturedR() {
 std::string TestSafeCallIntoR(cpp11::function r_fun_that_returns_a_string,
                               std::string opt) {
   if (opt == "async_with_executor") {
-    std::thread* thread_ptr;
+    std::unique_ptr<std::thread> thread_ptr;

Review Comment:
   You probably can do something like this instead:
   ```c++
   std::thread thread;
   auto result = RunWithCapturedR<std::string>([&thread, 
r_fun_that_returns_a_string]() {
     auto fut = arrow::Future<std::string>::Make();
     thread = std::thread([&fut, r_fun_that_returns_a_string]() {
       auto result = SafeCallIntoR<std::string>([&] {
         return cpp11::as_cpp<std::string>(r_fun_that_returns_a_string());
       });



-- 
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