diff options
author | Pixel <Pixel> | 2001-10-30 17:38:54 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2001-10-30 17:38:54 +0000 |
commit | 57633137f749b0098eaf703f49ed00c96128966d (patch) | |
tree | f7e55be48d4724d44e5ed2362cf836162e866d05 /lib/Task.cc | |
parent | e5057005049b11af44cb804118f95370f03ab32c (diff) |
Huge work on Tasking System.
Diffstat (limited to 'lib/Task.cc')
-rw-r--r-- | lib/Task.cc | 19 |
1 files changed, 17 insertions, 2 deletions
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 <iostream.h> #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"; +} |