summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/TaskMan.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc
index 1e1fba6..bf1a6be 100644
--- a/lib/TaskMan.cc
+++ b/lib/TaskMan.cc
@@ -158,6 +158,10 @@ void TaskMan::RemoveFromWatches(Task * t) {
TaskList.erase(p);
number--;
p--;
+ } else if ((*p) == t) {
+ TaskList.erase(p);
+ number--;
+ p--;
}
}
}
@@ -204,6 +208,12 @@ void TaskMan::MainLoop() throw (GeneralException) {
if (stopped) return;
cerr << "-=- TaskMan: begin main loop with " << number << " task to manage.\n";
+ for (TaskList_t::iterator p = TaskList.begin(); p && (p != TaskList.end()); p++) {
+ Task * t = *p;
+ cerr << "-=- TaskMan: task " << t->GetName() << endl;
+ }
+
+ cerr << "-=- TaskMan: processing burning tasks.\n";
no_burst = 0;
while (!no_burst) {
@@ -213,8 +223,6 @@ void TaskMan::MainLoop() throw (GeneralException) {
for (TaskList_t::iterator p = TaskList.begin(); p && (p != TaskList.end()); p++) {
Task * t = *p;
- cerr << "-=- TaskMan: task " << t->GetName() << endl;
-
if (t->IsStopped()) {
continue;
}
@@ -239,6 +247,7 @@ void TaskMan::MainLoop() throw (GeneralException) {
/* Now is time to check all the handle and enters into a wait state. */
event = E_HANDLE;
+ cerr << "-=- TaskMan: processing handle-waiting tasks.\n";
nfds = w4ha.size();
no_burst = 1;
@@ -382,6 +391,7 @@ void TaskMan::MainLoop() throw (GeneralException) {
no_zombies = 0;
event = E_TASK;
+ cerr << "-=- TaskMan: processing zombies loop.\n";
while (!no_zombies) {
no_zombies = 1;
@@ -418,6 +428,7 @@ void TaskMan::MainLoop() throw (GeneralException) {
/* To end up the loop, let's recall task waiting for processes */
event = E_PROCESS;
+ cerr << "-=- TaskMan: processing child-waiting tasks.\n";
if (got_sigchild) {
for (vector<w4pr_t>::iterator p = w4pr.begin(); p && (p != w4pr.end()); p++) {