From 791463bd7d6358fa137b3c786857770a720e7dac Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 23 May 2007 13:05:02 +0000 Subject: ChainTasks will now stop the tasks, resume them before waiting for them, and delete them when they are done. --- lib/ChainTasks.cc | 22 ++++++++++++++++++---- 1 file 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; } -- cgit v1.2.3