fixed #3

Merged
M merged 2 commits from planner_improve into main 2023-12-05 11:32:25 +00:00
Showing only changes of commit 79cf5bc0da - Show all commits

View File

@@ -157,14 +157,12 @@ public:
for (auto& empty : emptyKeys) for (auto& empty : emptyKeys)
sortedByKernelNeeds.erase(empty); sortedByKernelNeeds.erase(empty);
vector<T*> toDel;
// проверяем нет ли завершившихся задач // проверяем нет ли завершившихся задач
for (auto it = activeTaskSet.begin(); it != activeTaskSet.end(); ) for (auto& task : activeTaskSet)
{ {
T* task = *(it);
if (task->Check()) { if (task->Check()) {
it++; toDel.push_back(task);
activeTaskSet.erase(task);
activeTasks--; activeTasks--;
done++; done++;
busyKernels -= task->getKernels(); busyKernels -= task->getKernels();
@@ -172,11 +170,12 @@ public:
buf += to_string(task->getId()) + " " + string(task->printState().getCharArray()) + " " + to_string(task->getTotalTime()) + "\n"; buf += to_string(task->getId()) + " " + string(task->printState().getCharArray()) + " " + to_string(task->getTotalTime()) + "\n";
task->copyResults(pathRes); task->copyResults(pathRes);
continue;
} }
it++;
} }
for (auto& del : toDel)
activeTaskSet.erase(del);
if (oldActiveTasks != activeTasks) if (oldActiveTasks != activeTasks)
printf("done %ld / %ld\n", done, this->getLength()); printf("done %ld / %ld\n", done, this->getLength());
} }