[PATCH] D114183: [ThreadPool] Add template argument for future result type.(WIP)

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 18 15:12:53 PST 2021


Meinersbur added a comment.

The pre-merge check has found additional locations where template arguments need to be added. Did you consider using using `void` as default template argument, or make `ThreadPool` a typedef of "ThreadPoolWithResult<void>"?

However, I don't think that the ThreadPool itself needs to be a template, but just the async implementation such that one can enqueue tasks with different return types to the same thread pool:

  template <typename RetTy>
  inline std::shared_future<RetTy> async(std::function<RetTy()> &&F);

AFAIU, `std::packaged_task<>` already handles return values itself.


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