46 template <
typename Base = i_task>
51 task(
const std::string& aName = std::string{}) : iName{ aName }, iCancelled{ false }
56 const std::string&
name()
const override
77 std::atomic<bool> iCancelled;
90 return iPromise.get_future();
93 const std::string&
name()
const override
95 static std::string sName =
"neolib::function_task";
100 iPromise.set_value(iFunction());
103 std::function<T()> iFunction;
104 std::promise<T> iPromise;
111 iPromise.set_value();
std::future< T > get_future()
const std::string & name() const override
function_task(std::function< T()> aFunction)
void run(yield_type) override
bool cancelled() const override
void cancel() noexcept override
task(const std::string &aName=std::string{})
const std::string & name() const override
bool do_work(yield_type aYieldType=yield_type::NoYield) override