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

Daniel McIntosh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 24 08:14:02 PST 2021


DanielMcIntosh-IBM reopened this revision.
DanielMcIntosh-IBM added a comment.
This revision is now accepted and ready to land.

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?


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