diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Task.cc | 26 | ||||
-rw-r--r-- | lib/TaskMan.cc | 20 |
2 files changed, 21 insertions, 25 deletions
diff --git a/lib/Task.cc b/lib/Task.cc index b54402f..4f36c7b 100644 --- a/lib/Task.cc +++ b/lib/Task.cc @@ -50,7 +50,7 @@ void Task::Suspend() throw (GeneralException) { } void Task::WaitFor(Handle * h, int flags) { - w4ha.push_back(w4ha_t(h, flags)); + TaskMan::WaitFor(h, this, flags); } void Task::WaitFor(Task * t) { @@ -58,31 +58,11 @@ void Task::WaitFor(Task * t) { } void Task::WaitFor(pid_t p) { - w4pr.push_back(w4pr_t(p)); + TaskMan::WaitFor(p, this); } void Task::WaitFor(timeval t, int flags) { - w4to.push_back(w4to_t(t, flags)); -} - -bool Task::WaitingFor(Handle * ha) { - vector<w4ha_t>::iterator p; - - for (p = w4ha.begin(); p && (p != w4ha.end()); p++) { - if (p->ha == ha) return true; - } - - return false; -} - -bool Task::WaitingFor(pid_t pr) { - vector<w4pr_t>::iterator p; - - for (p = w4pr.begin(); p && (p != w4pr.end()); p++) { - if (p->pr == pr) return true; - } - - return false; + TaskMan::WaitFor(t, this, flags); } void Task::SetBurst() { diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc index 1af9234..bab9380 100644 --- a/lib/TaskMan.cc +++ b/lib/TaskMan.cc @@ -3,8 +3,12 @@ #include <vector.h> #include "TaskMan.h" -vector<Task *> TaskMan::TaskList; -vector<Task *> TaskMan::Zombies; +TaskMan::TaskList_t TaskMan::TaskList; +TaskMan::TaskList_t TaskMan::Zombies; +vector<TaskMan::w4ha_t> TaskMan::w4ha; +vector<TaskMan::w4pr_t> TaskMan::w4pr; +vector<TaskMan::w4to_t> TaskMan::w4to; + int TaskMan::number = 0; bool TaskMan::inited = false; @@ -40,6 +44,18 @@ int TaskMan::AddTask(Task * t) { return 0; } +void TaskMan::WaitFor(Handle * h, Task * t, int flags) { + w4ha.push_back(w4ha_t(h, flags, t)); +} + +void TaskMan::WaitFor(pid_t p, Task * t) { + w4pr.push_back(w4pr_t(p, t)); +} + +void TaskMan::WaitFor(timeval t, Task * T, int flags) { + w4to.push_back(w4to_t(t, flags, T)); +} + void TaskMan::MainLoop() throw (GeneralException) { TaskList_t::iterator p; Task * t; |