28 : on_completion_([]() {})
40 return complete_.load(std::memory_order::memory_order_acquire);
49 catch (std::exception &e)
52 "Task throwed an exception. It'll be swallowed but will still be stored " 55 eptr_ = std::current_exception();
72 complete_.store(
true, std::memory_order::memory_order_release);
77 << (
success_ ?
"successfully" :
"with error."));
82 std::unique_lock<std::mutex> ul(
mutex_);
84 return complete_.load(std::memory_order::memory_order_acquire);
const std::string & get_guid() const
std::function< void(void)> on_success_
std::exception_ptr get_exception() const
void print_exception(const std::exception &e, int level=0)
Recursively print the exception trace to std::cerr.
bool is_complete() const
Has the tasks completed its execution.
std::string gen_uuid()
Generate a new UUID.
std::condition_variable cv_
void wait()
Instead of spinlocking over is_complete() one can call wait() to hum...
std::function< void(void)> on_completion_
std::function< void(void)> on_failure_
std::atomic_bool complete_