summaryrefslogtreecommitdiff
path: root/src/TaskMan.cc
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-10-14 21:55:56 -0700
committerPixel <pixel@nobis-crew.org>2011-10-14 21:55:56 -0700
commit953a4572e09a05dab4487b75eeb1f267b9e22c3a (patch)
tree5560bb6542d556777b54d590cb355d95a09cbb27 /src/TaskMan.cc
parentae657c4c8358b66d1ef867b8f90b1eaebaaa71ea (diff)
Fixing a few bugs.
-) The IO class needed an assignment operator, as well as the ability to NOT contain a Handle. -) The Task Manager wasn't properly starting up pending tasks that got added during startup.
Diffstat (limited to 'src/TaskMan.cc')
-rw-r--r--src/TaskMan.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/TaskMan.cc b/src/TaskMan.cc
index 3b715ce..5a0c1c1 100644
--- a/src/TaskMan.cc
+++ b/src/TaskMan.cc
@@ -48,17 +48,21 @@ void Balau::TaskMan::mainLoop() {
// checking "STARTING" tasks, and running them once; also try to build the status of the noWait boolean.
for (iH = m_tasks.begin(); iH != m_tasks.end(); iH++) {
t = *iH;
- if (t->getStatus() == Task::STARTING) {
+ if (t->getStatus() == Task::STARTING)
t->switchTo();
- if ((t->getStatus() == Task::STOPPED) || (t->getStatus() == Task::FAULTED))
- noWait = true;
- }
+ if ((t->getStatus() == Task::STOPPED) || (t->getStatus() == Task::FAULTED))
+ noWait = true;
}
// probably means we have pending tasks; or none at all, for some reason. Don't wait on it forever.
- if (!noWait && m_tasks.size() == 0)
+ if (m_tasks.size() == 0)
noWait = true;
+ m_pendingLock.enter();
+ if (m_pendingAdd.size() != 0)
+ noWait = true;
+ m_pendingLock.leave();
+
// libev's event "loop". We always runs it once though.
ev_run(m_loop, noWait ? EVRUN_NOWAIT : EVRUN_ONCE);