summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2014-02-15 19:35:24 -0800
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2014-02-15 19:35:24 -0800
commitfde54d397fd9d83c50e5cfb5a9244200b1b08615 (patch)
treec22212d8ceac695dd37ca696e18b8695b1ba474e /src
parent67c91ea0cfefecda5f6456c8db85900a459bebcf (diff)
Fixing rare bug mixup with the yielded list when a task went to sleep immediately after yielding.
Diffstat (limited to 'src')
-rw-r--r--src/TaskMan.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/TaskMan.cc b/src/TaskMan.cc
index 7bf0aa0..dd4a07a 100644
--- a/src/TaskMan.cc
+++ b/src/TaskMan.cc
@@ -289,17 +289,18 @@ int Balau::TaskMan::mainLoop() {
for (Task * t : m_signaledTasks) {
Printer::elog(E_TASK, "TaskMan at %p Switching to task %p (%s - %s) that got signaled somehow.", this, t, t->getName(), ClassName(t).c_str());
IAssert(t->getStatus() == Task::SLEEPING || t->getStatus() == Task::YIELDED, "We're switching to a non-sleeping/yielded task at %p... ? status = %i", t, t->getStatus());
- bool wasYielded = t->getStatus() == Task::YIELDED;
+ bool toRemoveFromYielded = t->getStatus() == Task::YIELDED;
t->switchTo();
if ((t->getStatus() == Task::STOPPED) || (t->getStatus() == Task::FAULTED)) {
stopped.insert(t);
- if (wasYielded) {
- taskHash_t::iterator i = yielded.find(t);
- IAssert(i != yielded.end(), "Task %s of type %s at %p was yielded, but not in yielded list... ?", t->getName(), ClassName(t).c_str(), t);
- yielded.erase(i);
- }
} else if (t->getStatus() == Task::YIELDED) {
yielded.insert(t);
+ toRemoveFromYielded = false;
+ }
+ if (toRemoveFromYielded) {
+ taskHash_t::iterator i = yielded.find(t);
+ IAssert(i != yielded.end(), "Task %s of type %s at %p was yielded, but not in yielded list... ?", t->getName(), ClassName(t).c_str(), t);
+ yielded.erase(i);
}
}
m_signaledTasks.clear();