diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-06-18 07:27:57 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-06-18 08:07:20 +0200 |
commit | 80290e7d65dc498e9ea5e64aa6cbc65282072deb (patch) | |
tree | 796f723f449d58615c6d81f5eecd212a1e4d0399 /task.h | |
parent | 33addfbf9cc21cd69b3d6476eb0c062bb2c6fcfb (diff) |
New dependency system.
Diffstat (limited to 'task.h')
-rw-r--r-- | task.h | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -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; }; |