[PATCH] D114183: [ThreadPool] Support returning futures with results.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 25 09:43:02 PST 2021


thakis added a comment.

In D114183#3151653 <https://reviews.llvm.org/D114183#3151653>, @DanielMcIntosh-IBM wrote:

> It seems like you may have missed some issues with const vs. non-const types in the case when `LLVM_ENABLE_THREADS` is false.
> I think it should be pretty easy to fix, but I don't know ThreadPool well enough to quickly address it myself.
> This is the error:
>
>   llvm/include/llvm/Support/ThreadPool.h:127:29: error: 'this' argument to member function 'get' has type 'const std::future<void>', but function is not marked const
>       Tasks.push([Future]() { Future.get(); });
>                               ^~~~~~
>   llvm/include/llvm/Support/ThreadPool.h:60:12: note: in instantiation of function template specialization 'llvm::ThreadPool::asyncImpl<void>' requested here
>       return asyncImpl(std::function<decltype(F())()>(std::forward<Func>(F)));
>              ^
>   llvm/include/llvm/Support/ThreadPool.h:54:12: note: in instantiation of function template specialization 'llvm::ThreadPool::async<std::__bind<(lambda at llvm/lib/CodeGen/ParallelCG.cpp:80:15), llvm::SmallString<0>>>' requested here
>       return async(std::move(Task));
>              ^
>   future:1239:10: note: 'get' declared here
>       void get();
>
> Do you mind submitting a fix?

Your revert breaks normal building: http://45.33.8.238/linux/61593/step_4.txt

PTAL.


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