This depends on D48240. After this patch, you will be able to do somethign like
shared_future<int> F = TQ.async([] { return 42; }); shared_future<Error> F2 = TQ.async([] { return someFunctionThatMightFail(); });
Paths
| Differential D48306
Make TaskQueue support tasks that return values Needs ReviewPublic Authored by zturner on Jun 18 2018, 5:23 PM.
Details
Diff Detail Event Timeline
Revision Contents
Diff 151832 llvm/include/llvm/Support/TaskQueue.h
llvm/lib/Support/TaskQueue.cpp
llvm/unittests/Support/TaskQueueTest.cpp
|
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
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).