summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2007-05-23 13:05:02 +0000
committerpixel <pixel>2007-05-23 13:05:02 +0000
commit791463bd7d6358fa137b3c786857770a720e7dac (patch)
treec85b3a0b2daca46e3a39bd58a540337396c67c77
parent897372d73679dfc077e9d808faeaf2b73c01a95d (diff)
ChainTasks will now stop the tasks, resume them before waiting for them,
and delete them when they are done.
-rw-r--r--lib/ChainTasks.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/ChainTasks.cc b/lib/ChainTasks.cc
index 033cadf..6a816e7 100644
--- a/lib/ChainTasks.cc
+++ b/lib/ChainTasks.cc
@@ -2,8 +2,14 @@
ChainTasks::ChainTasks(tasklist_t _tasklist) : tasklist(_tasklist) {
+ tasklist_iter_t i;
+
SetBurst();
pos = tasklist.begin();
+
+ for (i = tasklist.begin(); i != tasklist.end(); i++) {
+ (*i)->Stop();
+ }
}
ChainTasks::~ChainTasks() {
@@ -14,10 +20,18 @@ String ChainTasks::GetName() {
}
int ChainTasks::Do() throw (GeneralException) {
- if (pos == tasklist.end())
- return TASK_DONE;
+ switch (current) {
+ case 1:
+ delete *pos;
+ pos++;
+ case 0:
+ if (pos == tasklist.end())
+ return TASK_DONE;
- WaitFor(*pos);
- pos++;
+ (*pos)->Restart();
+ WaitFor(*pos);
+ current = 1;
+ Suspend(TASK_ON_HOLD);
+ }
return TASK_ON_HOLD;
}