From 709543dec3eaa07f7d2d7da2157d1f9159bad5d8 Mon Sep 17 00:00:00 2001 From: Pixel Date: Mon, 12 Nov 2001 16:11:04 +0000 Subject: Taskman --- include/Exceptions.h | 2 ++ include/Task.h | 5 +++++ include/TaskMan.h | 8 ++++---- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'include') 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 + #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 #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 TaskList; - static int Inited; + vector TaskList; + static bool Inited; }; #else -- cgit v1.2.3