From 57633137f749b0098eaf703f49ed00c96128966d Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 30 Oct 2001 17:38:54 +0000 Subject: Huge work on Tasking System. --- lib/Task.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'lib/Task.cc') diff --git a/lib/Task.cc b/lib/Task.cc index 79c39e1..27d2a24 100644 --- a/lib/Task.cc +++ b/lib/Task.cc @@ -1,6 +1,8 @@ +#include #include "Task.h" +#include "String.h" -Task::Task() {} +Task::Task() : state(TASK_ON_HOLD) {} Task::~Task() {} int Task::Do() { @@ -8,9 +10,22 @@ int Task::Do() { } int Task::Run() { - return (state = Do()); + cerr << "Running task '" << GetName() << "'...\n"; + try { + while ((state = Do()) != TASK_DONE); + } + catch (GeneralException e) { + cerr << "Task " << GetName() << " caused an unexpected exception: '" << e.GetMsg() << "', closing it.\n"; + return TASK_DONE; + } + + return state; } int Task::GetState() { return state; } + +String Task::GetName() { + return "Unknow Task"; +} -- cgit v1.2.3