Skip to content

Commit fb17106

Browse files
author
Rafał Hibner
committed
Do not continue outside future
1 parent 23a887a commit fb17106

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

cpp/src/arrow/util/async_util.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class ThrottledAsyncTaskSchedulerImpl
324324
return true;
325325
} else {
326326
lk.unlock();
327-
return SubmitTask(std::move(task), latched_cost, /*in_continue=*/false);
327+
return SubmitTask(std::move(task), latched_cost);
328328
}
329329
}
330330

@@ -337,12 +337,12 @@ class ThrottledAsyncTaskSchedulerImpl
337337
const util::tracing::Span& span() const override { return target_->span(); }
338338

339339
private:
340-
bool SubmitTask(std::unique_ptr<Task> task, int latched_cost, bool in_continue) {
340+
bool SubmitTask(std::unique_ptr<Task> task, int latched_cost) {
341341
// Wrap the task with a wrapper that runs it and then checks to see if there are any
342342
// queued tasks
343343
std::string_view name = task->name();
344344
return target_->AddSimpleTask(
345-
[latched_cost, in_continue, inner_task = std::move(task),
345+
[latched_cost, inner_task = std::move(task),
346346
self = shared_from_this()]() mutable -> Result<Future<>> {
347347
ARROW_ASSIGN_OR_RAISE(Future<> inner_fut, (*inner_task)());
348348
if (!inner_fut.TryAddCallback([&] {
@@ -357,9 +357,6 @@ class ThrottledAsyncTaskSchedulerImpl
357357
// if we are already running it so we can avoid stack overflow
358358
self->throttle_->Release(latched_cost);
359359
inner_task.reset();
360-
if (!in_continue) {
361-
self->ContinueTasks();
362-
}
363360
}
364361
return inner_fut;
365362
},
@@ -390,7 +387,7 @@ class ThrottledAsyncTaskSchedulerImpl
390387
} else {
391388
std::unique_ptr<Task> next_task = queue_->Pop();
392389
lk.unlock();
393-
if (!SubmitTask(std::move(next_task), next_cost, /*in_continue=*/true)) {
390+
if (!SubmitTask(std::move(next_task), next_cost)) {
394391
return;
395392
}
396393
lk.lock();

0 commit comments

Comments
 (0)