westonpace commented on a change in pull request #9892:
URL: https://github.com/apache/arrow/pull/9892#discussion_r610352912



##########
File path: cpp/src/arrow/util/thread_pool.h
##########
@@ -233,15 +233,7 @@ class ARROW_EXPORT SerialExecutor : public Executor {
     if (final_fut.is_finished()) {
       return final_fut.result();
     }
-    final_fut = final_fut.Then(
-        [this](const T& res) {
-          MarkFinished();
-          return res;
-        },
-        [this](const Status& st) -> Result<T> {
-          MarkFinished();
-          return st;
-        });
+    final_fut.AddCallback([this](const Result<T>&) { MarkFinished(); });

Review comment:
       Ah, sure enough...
   > Notifying while under the lock may nevertheless be necessary when precise 
scheduling of events is required, e.g. if the waiting thread would exit the 
program if the condition is satisfied, causing destruction of the notifying 
thread's condition_variable.
   
   From https://en.cppreference.com/w/cpp/thread/condition_variable/notify_one




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

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


Reply via email to