--- smsdaemon/TaskManager.cpp 2008/12/18 06:47:26 195 +++ smsdaemon/TaskManager.cpp 2008/12/18 06:53:29 196 @@ -1,4 +1,4 @@ - + #include "TaskManager.h" #include "Logger.h" @@ -9,12 +9,12 @@ TaskManager::TaskManager() - : _lastExecuted(0) + : _lastExecuted(0) { } - + TaskManager::~TaskManager() -{ +{ //delete any temporary tasks still in the list std::list::iterator it; for (it = _temp_tasks.begin(); it != _temp_tasks.end(); ++it) @@ -29,8 +29,8 @@ static SpoolTask task; //print the loaded tasks - std::map::iterator it; - for(it = _persistant_tasks.begin(); it != _persistant_tasks.end(); ++it) + std::map::iterator it; + for (it = _persistant_tasks.begin(); it != _persistant_tasks.end(); ++it) { Task* tsk = (*it).second; if (tsk != 0) @@ -68,7 +68,7 @@ const int SLEEP_TIME = 2; //wait this long between task executions int now = time(0); - if (now < (_lastExecuted + SLEEP_TIME) ) + if (now < (_lastExecuted + SLEEP_TIME) ) return; _lastExecuted = now; @@ -94,11 +94,11 @@ if ( tsk->IsFinished() ) { delete tsk; - l_it = _temp_tasks.erase(l_it); - + l_it = _temp_tasks.erase(l_it); + //now l_it points to the next element in the list, //but since the for() loop will increment it before next iteration we will decrease it here - --l_it; + --l_it; } }