[PATCH] D48306: Make TaskQueue support tasks that return values
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 19 01:34:15 PDT 2018
labath added inline comments.
================
Comment at: llvm/include/llvm/Support/TaskQueue.h:115-116
+ auto WrappedTask = [this, ParentTask, F] {
+ if (ParentTask)
+ ParentTask->wait();
+
----------------
This depends a lot on the results of the discussion with Chandler on the other patch, but I was thinking about this possibly long recursion chain caused by these ParentTask links.
I think think we could avoid the recursion if instead of `ParentTask->wait()`, we did something like `TaskQueue->wait(ThisTask.get())`. The TaskQueue function would do something like
```
while (Tasks.front().get() != TaskToWaitFor) Tasks.front()->execute(); // Details about who pops the task TBD
TaskToWaitFor->execute();
```
The existing `wait` function would be a special case of this one for `TaskToWaitFor = Tasks.back().get()`. I think this would also allow you to avoid having a shared_ptrs in the task queue (just plain unique_ptr should suffice).
https://reviews.llvm.org/D48306
More information about the llvm-commits
mailing list