summaryrefslogtreecommitdiff
path: root/task.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-06-19 09:18:26 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2021-06-19 09:18:26 +0200
commita2be8eba3aaf11a9a73092793d27d6d46b4270cd (patch)
treeec8d463fe0537785337b4632e0c59bc1185b68dc /task.cc
parent80290e7d65dc498e9ea5e64aa6cbc65282072deb (diff)
Add .so target. Fix ready state checks.
Diffstat (limited to 'task.cc')
-rw-r--r--task.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/task.cc b/task.cc
index d539b50..10e9368 100644
--- a/task.cc
+++ b/task.cc
@@ -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();
}