diff options
author | Pixel <pixel@nobis-crew.org> | 2012-04-03 16:23:25 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2012-04-03 16:23:25 -0700 |
commit | a252ec77684c43666923e5e49f57c48c10a9865d (patch) | |
tree | 2b73bfe03cd28d50472f55a6fc69c50bba13470a /src | |
parent | b3a4daf5a8c99957ec1f46618eca562095ad1d3e (diff) |
Simplifying the logic in the compuation of the noWait boolean.
Diffstat (limited to 'src')
-rw-r--r-- | src/TaskMan.cc | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/TaskMan.cc b/src/TaskMan.cc index 5b8c534..cb2c567 100644 --- a/src/TaskMan.cc +++ b/src/TaskMan.cc @@ -208,30 +208,23 @@ int Balau::TaskMan::mainLoop() { starting.insert(t); do { - bool noWait = false; - Printer::elog(E_TASK, "TaskMan::mainLoop() at %p with m_tasks.size = %li", this, m_tasks.size()); - // checking "STARTING" tasks, and running them once; also try to build the status of the noWait boolean. + // checking "STARTING" tasks, and running them once while ((iH = starting.begin()) != starting.end()) { Task * t = *iH; IAssert(t->getStatus() == Task::STARTING, "Got task at %p in the starting list, but isn't starting.", t); t->switchTo(); IAssert(t->getStatus() != Task::STARTING, "Task at %p got switchedTo, but still is 'STARTING'.", t); starting.erase(iH); - if ((t->getStatus() == Task::STOPPED) || (t->getStatus() == Task::FAULTED)) { - noWait = true; + if ((t->getStatus() == Task::STOPPED) || (t->getStatus() == Task::FAULTED)) stopped.insert(t); - } - if (t->getStatus() == Task::YIELDED) { - noWait = true; + if (t->getStatus() == Task::YIELDED) yielded.insert(t); - } } // if we begin that loop with any pending task, just don't loop, so we can add them immediately. - if (!m_pendingAdd.isEmpty() || !yielded.empty() || !stopped.empty()) - noWait = true; + bool noWait = !m_pendingAdd.isEmpty() || !yielded.empty() || !stopped.empty(); // libev's event "loop". We always runs it once though. m_allowedToSignal = true; |