diff options
Diffstat (limited to 'task.cc')
-rw-r--r-- | task.cc | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -39,32 +39,38 @@ bool Task::ready() { for(const auto& task : dependsTasks) { - if(task->dirty() && !task->done()) + if(task->dirty() || task->state() == State::Running) { return false; } } + task_state.store(State::Ready); return true; } int Task::run() { - if(is_done.load()) + if(task_state.load() == State::Done) { return 0; } + task_state.store(State::Running); auto ret = runInner(); if(ret == 0) { - is_done.store(true); + task_state.store(State::Done); + } + else + { + task_state.store(State::Error); } return ret; } -bool Task::done() const +State Task::state() const { - return is_done.load(); + return task_state.load(); } |