summaryrefslogtreecommitdiff
path: root/task.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-06-18 07:27:57 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2021-06-18 08:07:20 +0200
commit80290e7d65dc498e9ea5e64aa6cbc65282072deb (patch)
tree796f723f449d58615c6d81f5eecd212a1e4d0399 /task.h
parent33addfbf9cc21cd69b3d6476eb0c062bb2c6fcfb (diff)
New dependency system.
Diffstat (limited to 'task.h')
-rw-r--r--task.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/task.h b/task.h
index 443b6b7..2dd05e3 100644
--- a/task.h
+++ b/task.h
@@ -3,13 +3,30 @@
#include <vector>
#include <string>
+#include <atomic>
+#include <list>
+#include <memory>
class Task
{
public:
- virtual bool dirty() = 0;
- virtual int run() = 0;
+ Task(const std::vector<std::string>& depends);
+
+ void registerDepTasks(const std::list<std::shared_ptr<Task>>& tasks);
+
+ bool dirty();
+ bool ready();
+ int run();
+ bool done() const;
virtual int clean() = 0 ;
virtual std::vector<std::string> depends() const = 0;
virtual std::string target() const = 0;
+
+protected:
+ std::atomic<bool> is_done{false};
+ virtual int runInner() { return 0; };
+ virtual bool dirtyInner() { return false; }
+
+ std::vector<std::string> dependsStr;
+ std::list<std::shared_ptr<Task>> dependsTasks;
};