diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/Exceptions.h | 2 | ||||
-rw-r--r-- | include/Task.h | 5 | ||||
-rw-r--r-- | include/TaskMan.h | 8 |
3 files changed, 11 insertions, 4 deletions
diff --git a/include/Exceptions.h b/include/Exceptions.h index 6862036..04b30d6 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -115,6 +115,8 @@ class TaskSwitch : public GeneralException { TaskSwitch(); }; +#include <String.h> + #else #error This only works with a C++ compiler #endif diff --git a/include/Task.h b/include/Task.h index f2fe722..4de3fa5 100644 --- a/include/Task.h +++ b/include/Task.h @@ -2,6 +2,7 @@ #define __TASK_H__ #ifdef __cplusplus +#include <setjmp.h> #include "Exceptions.h" #define TASK_ON_HOLD 0 @@ -14,11 +15,15 @@ class Task : public Base { virtual String GetName(); int Run(); int GetState(); + int Suspend() throw (GeneralException); + void Resume(int) throw (GeneralException); protected: virtual int Do(); private: + jmp_buf env; int state; + bool suspended; }; #else diff --git a/include/TaskMan.h b/include/TaskMan.h index ca1cdb8..1efff93 100644 --- a/include/TaskMan.h +++ b/include/TaskMan.h @@ -7,13 +7,13 @@ class TaskMan : public Base { public: - TaskMan(); + TaskMan() throw (GeneralException); ~TaskMan(); - int AddTask(const Task &); + int AddTask(Task *); void MainLoop(); private: - vector<Task> TaskList; - static int Inited; + vector<Task *> TaskList; + static bool Inited; }; #else |