[PATCH] D114183: [ThreadPool] Add template argument for future result type.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 19 13:44:38 PST 2021
fhahn added a comment.
In D114183#3143742 <https://reviews.llvm.org/D114183#3143742>, @mehdi_amini wrote:
> This seems like a bit of a "niche" extension: it makes it possible to return future but only for a statically predefined type. Is there a way to type-erase this in the threadpool a bit better and manager this at "enqueue time" instead so that each new task can return its own future?
>
> Also isn't this feature something that can likely be layered on top of the existing ThreadPool without changing it?
> For example by wrapping the submitted task into another object that manages the promise/future.
I think that's what Michael was asking/suggestion in the previous comment :)
My main goal is to use futures with non-void results, I'm happy to go with whatever implementation people think is most useful. Introducing a predefined type was a mostly mechanical change, but as I said if changing the packaging is preferred, I can adjust the code.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114183/new/
https://reviews.llvm.org/D114183
More information about the llvm-commits
mailing list