Reduce CPU hit in FGTaxiSegment::unblock
size() is O(N), empty() is constant time.
This commit is contained in:
parent
95be7220a2
commit
35c5be004f
1 changed files with 5 additions and 7 deletions
|
@ -121,15 +121,13 @@ bool FGTaxiSegment::hasBlock(time_t now)
|
|||
|
||||
void FGTaxiSegment::unblock(time_t now)
|
||||
{
|
||||
if (blockTimes.size()) {
|
||||
BlockListIterator i = blockTimes.begin();
|
||||
if (i->getTimeStamp() < (now - 30)) {
|
||||
blockTimes.erase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (blockTimes.empty())
|
||||
return;
|
||||
|
||||
if (blockTimes.front().getTimeStamp() < (now - 30)) {
|
||||
blockTimes.erase(blockTimes.begin());
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* FGTaxiRoute
|
||||
|
|
Loading…
Reference in a new issue