23 #include <condition_variable> 75 template <
typename Callback>
87 template <
typename Callback>
99 template <
typename Callback>
105 const std::string &
get_guid()
const;
108 virtual bool do_run() = 0;
119 std::condition_variable
cv_;
const std::string & get_guid() const
std::function< void(void)> on_success_
std::exception_ptr get_exception() const
This is the header file for a generated source file, GitSHA1.cpp.
void set_on_completion(Callback c)
Set a callback that will be invoked when the tasks is completed, no matter if it succeeded or not...
Task & operator=(const Task &)=delete
A base class for a tasks.
bool is_complete() const
Has the tasks completed its execution.
std::condition_variable cv_
void wait()
Instead of spinlocking over is_complete() one can call wait() to hum...
std::function< void(void)> on_completion_
void set_on_failure(Callback c)
Set a callback that will be invoked if and when the task fails.
std::function< void(void)> on_failure_
std::atomic_bool complete_
void set_on_success(Callback c)
Set a callback that will be invoked if and when the task succeed.