lidavidm commented on code in PR #15104:
URL: https://github.com/apache/arrow/pull/15104#discussion_r1059424778
##########
cpp/src/arrow/util/async_util.cc:
##########
@@ -188,8 +192,20 @@ class AsyncTaskSchedulerImpl : public AsyncTaskScheduler {
void AbortUnlocked(const Status& st, std::unique_lock<std::mutex>&& lk) {
DCHECK(!st.ok());
+ bool aborted = false;
if (!IsAborted()) {
maybe_error_ = st;
+ // Add one more "task" to represent running the abort callback. This
+ // will prevent any other task finishing and marking the scheduler
finished
+ // while we are running the abort callback.
+ running_tasks_++;
+ aborted = true;
+ }
+ if (aborted) {
+ lk.unlock();
+ std::move(abort_callback_)(st);
+ lk.lock();
+ running_tasks_--;
Review Comment:
I read it backwards :grimacing: thought it was lock then unlock, not the
other way around.
--
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]