diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ChainTasks.cc | 22 |
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; } |