Merge "timer bug fix"

This commit is contained in:
Linux Build Service Account 2015-09-19 15:13:48 -07:00 committed by Gerrit - the friendly Code Review server
commit 049cc84d3a
2 changed files with 8 additions and 4 deletions

View file

@ -199,7 +199,7 @@ bool LocHeapNode::checkNodes() {
int totalSize = mSize; int totalSize = mSize;
if (mLeft) { if (mLeft) {
// check the consistency of left subtree // check the consistency of left subtree
if (!outRanks(*mLeft) || !mLeft->checkNodes()) { if (mLeft->outRanks(*this) || !mLeft->checkNodes()) {
return false; return false;
} }
// subtract the size of left subtree (with subtree head) // subtract the size of left subtree (with subtree head)
@ -208,7 +208,7 @@ bool LocHeapNode::checkNodes() {
if (mRight) { if (mRight) {
// check the consistency of right subtree // check the consistency of right subtree
if (!outRanks(*mRight) || !mRight->checkNodes()) { if (mRight->outRanks(*this) || !mRight->checkNodes()) {
return false; return false;
} }
// subtract the size of right subtree (with subtree head) // subtract the size of right subtree (with subtree head)

View file

@ -349,8 +349,12 @@ void LocTimerContainer::remove(LocTimerDelegate& timer) {
LocMsg(), mTimerContainer(&container), mTimer(&timer) {} LocMsg(), mTimerContainer(&container), mTimer(&timer) {}
inline virtual void proc() const { inline virtual void proc() const {
LocTimerDelegate* priorTop = mTimerContainer->getSoonestTimer(); LocTimerDelegate* priorTop = mTimerContainer->getSoonestTimer();
if (NULL != ((LocHeap*)mTimerContainer)->remove((LocRankable&)*mTimer)) { // update soonest timer only if mTimer is actually removed from mTimerContainer
mTimerContainer->updateSoonestTime(priorTop); // AND mTimer is not priorTop.
if (priorTop == ((LocHeap*)mTimerContainer)->remove((LocRankable&)*mTimer)) {
// if passing in NULL, we tell updateSoonestTime to update kernel with
// the current top timer interval.
mTimerContainer->updateSoonestTime(NULL);
} }
delete mTimer; delete mTimer;
} }