- attempt to fix hang issue reported by tomreyn
This commit is contained in:
parent
1f8d1b68eb
commit
1fd179196c
|
@ -877,6 +877,7 @@ Command *Unit::getCurrrentCommandThreadSafe() {
|
|||
if(commands.empty() == false) {
|
||||
return commands.front();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1078,6 +1079,7 @@ CommandResult Unit::cancelCommand() {
|
|||
this->unitPath->clear();
|
||||
|
||||
safeMutex.ReleaseLock();
|
||||
|
||||
return crSuccess;
|
||||
}
|
||||
|
||||
|
@ -2087,6 +2089,7 @@ void Unit::clearCommands() {
|
|||
delete commands.back();
|
||||
commands.pop_back();
|
||||
}
|
||||
safeMutex.ReleaseLock();
|
||||
}
|
||||
|
||||
void Unit::deleteQueuedCommand(Command *command) {
|
||||
|
|
|
@ -292,7 +292,8 @@ void World::updateAllFactionUnits() {
|
|||
|
||||
unitsInFactionsSorted[faction->getIndex()].push_back(CommandGroupSorter(unit));
|
||||
}
|
||||
std::sort(unitsInFactionsSorted[faction->getIndex()].begin(),unitsInFactionsSorted[faction->getIndex()].end());
|
||||
std::vector<CommandGroupSorter> &unitListToSort = unitsInFactionsSorted[faction->getIndex()];
|
||||
std::sort(unitListToSort.begin(),unitListToSort.end());
|
||||
}
|
||||
|
||||
// Signal the faction threads to do any pre-processing
|
||||
|
@ -301,7 +302,8 @@ void World::updateAllFactionUnits() {
|
|||
if(faction == NULL) {
|
||||
throw runtime_error("faction == NULL");
|
||||
}
|
||||
faction->signalWorkerThread(frameCount,&unitsInFactionsSorted[faction->getIndex()]);
|
||||
std::vector<CommandGroupSorter> &unitListSorted = unitsInFactionsSorted[faction->getIndex()];
|
||||
faction->signalWorkerThread(frameCount,&unitListSorted);
|
||||
}
|
||||
|
||||
bool workThreadsFinished = false;
|
||||
|
@ -338,9 +340,11 @@ void World::updateAllFactionUnits() {
|
|||
throw runtime_error("faction == NULL");
|
||||
}
|
||||
|
||||
int unitCount = unitsInFactionsSorted[faction->getIndex()].size();
|
||||
std::vector<CommandGroupSorter> &unitListSorted = unitsInFactionsSorted[faction->getIndex()];
|
||||
|
||||
int unitCount = unitListSorted.size();
|
||||
for(int j = 0; j < unitCount; ++j) {
|
||||
Unit *unit = unitsInFactionsSorted[faction->getIndex()][j].unit;
|
||||
Unit *unit = unitListSorted[j].unit;
|
||||
if(unit == NULL) {
|
||||
throw runtime_error("unit == NULL");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue