Closed pfeatherstone closed 3 months ago
Sorry, fixed it! Two fixes: Replace:
using task = std::function<void()>;
with
using task = std::move_only_function<void()>;
or
using task = fu2::unique_function<void()>;
then replace
auto executor = [&](auto&& work) {
tp.async_detach(std::forward<decltype(work)>(work));
};
with
auto executor = [&](auto&& work) {
tp.async_detach([work_ = std::forward<decltype(work)>(work)] mutable { std::move(work_)(); });
};
@Naios
I am trying to build a basic task system using a custom thread pool and the continuable library. The code I'm using is as follows:
This doesn't compile and I can't figure out why.
Commit Hash
master
Expected Behavior
I expect this to work as the documentation on custom executors is pretty simple and what i've written seems to conform.
Actual Behavior
Compilation error.
Steps to Reproduce
Run the code above.
Your Environment