diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/Task.h | 29 | ||||
-rw-r--r-- | include/TaskMan.h | 31 |
2 files changed, 32 insertions, 28 deletions
diff --git a/include/Task.h b/include/Task.h index 39b414f..cdc51c0 100644 --- a/include/Task.h +++ b/include/Task.h @@ -22,12 +22,10 @@ class Task : public Base { int Run(); int GetState(); void Suspend() throw (GeneralException); - void WaitFor(Handle *, int = 0); void WaitFor(Task *); + void WaitFor(Handle *, int = 0); void WaitFor(pid_t); - void WaitFor(struct timeval, int = 0); - bool WaitingFor(Handle *); - bool WaitingFor(pid_t); + void WaitFor(timeval, int = 0); void SetBurst(); void SetCleanUp(); bool HasToClean(); @@ -40,40 +38,17 @@ class Task : public Base { int current; private: - class w4ha_t { - public: - w4ha_t(Handle * aha, int aflags) : ha(aha), flags(aflags) { } - Handle * ha; - int flags; - }; - class wbta_t { public: wbta_t(Task * ata) : ta(ata) { } Task * ta; }; - class w4pr_t { - public: - w4pr_t(pid_t apr) : pr(apr) { } - pid_t pr; - }; - - class w4to_t { - public: - w4to_t(timeval ato, int aflags) : to(ato), flags(aflags) { } - timeval to; - int flags; - }; - int state; bool stopped; bool cleanup; bool suspended; - vector<w4ha_t> w4ha; vector<wbta_t> wbta; - vector<w4pr_t> w4pr; - vector<w4to_t> w4to; }; #else diff --git a/include/TaskMan.h b/include/TaskMan.h index e1c59d0..e649956 100644 --- a/include/TaskMan.h +++ b/include/TaskMan.h @@ -10,13 +10,42 @@ class TaskMan : public Base { static int AddTask(Task *); static void Init() throw (GeneralException); static void MainLoop() throw (GeneralException); + static void WaitFor(Handle *, Task *, int = 0); + static void WaitFor(pid_t, Task *); + static void WaitFor(timeval, Task *, int = 0); - private: + class w4ha_t { + public: + w4ha_t(Handle * aha, int aflags, Task * aT) : ha(aha), flags(aflags), T(aT) { } + Handle * ha; + int flags; + Task * T; + }; + + class w4pr_t { + public: + w4pr_t(pid_t apr, Task * aT) : pr(apr), T(aT) { } + pid_t pr; + Task * T; + }; + + class w4to_t { + public: + w4to_t(timeval ato, int aflags, Task * aT) : to(ato), flags(aflags), T(aT) { } + timeval to; + int flags; + Task * T; + }; typedef vector<Task *> TaskList_t; + + private: static TaskList_t TaskList; static TaskList_t Zombies; static int number; static bool inited; + static vector<w4ha_t> w4ha; + static vector<w4pr_t> w4pr; + static vector<w4to_t> w4to; }; #else |