summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Task.cc3
-rw-r--r--src/TaskMan.cc4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/Task.cc b/src/Task.cc
index a4ec5bc..b294fa9 100644
--- a/src/Task.cc
+++ b/src/Task.cc
@@ -250,8 +250,9 @@ void Balau::Events::TaskEvent::ack() {
break;
}
}
- t->m_eventLock.leave();
Printer::elog(E_TASK, "TaskEvent at %p being ack; removing from the 'waited by' list of %p (%s - %s); deleted = %s", this, t, t->getName(), ClassName(t).c_str(), deleted ? "true" : "false");
+ t->m_eventLock.leave();
+ t = NULL;
IAssert(deleted, "We didn't find task %p in the waitedBy lists... ?", this);
m_ack = true;
reset();
diff --git a/src/TaskMan.cc b/src/TaskMan.cc
index ae6cdcc..71d5bc6 100644
--- a/src/TaskMan.cc
+++ b/src/TaskMan.cc
@@ -333,6 +333,7 @@ int Balau::TaskMan::mainLoop() {
for (auto iH = stopped.begin(); iH != stopped.end(); iH++) {
Task * t = *iH;
IAssert((t->getStatus() == Task::STOPPED) || (t->getStatus() == Task::FAULTED), "Task %p in stopped list but isn't stopped.", t);
+ t->m_eventLock.enter();
if (t->m_waitedBy.size() == 0) {
freeStack(t->m_stack);
stopped.erase(iH);
@@ -340,10 +341,13 @@ int Balau::TaskMan::mainLoop() {
IAssert(iH != m_tasks.end(), "Task %p in stopped list but not in m_tasks...", t);
m_tasks.erase(iH);
IAssert(yielded.find(t) == yielded.end(), "Task %p is deleted but is in yielded list... ?", t);
+ t->m_eventLock.leave();
delete t;
didDelete = true;
break;
}
+ if (!didDelete)
+ t->m_eventLock.leave();
}
} while (didDelete);