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;
if (mLeft) {
// check the consistency of left subtree
if (!outRanks(*mLeft) || !mLeft->checkNodes()) {
if (mLeft->outRanks(*this) || !mLeft->checkNodes()) {
return false;
}
// subtract the size of left subtree (with subtree head)
@ -208,7 +208,7 @@ bool LocHeapNode::checkNodes() {
if (mRight) {
// check the consistency of right subtree
if (!outRanks(*mRight) || !mRight->checkNodes()) {
if (mRight->outRanks(*this) || !mRight->checkNodes()) {
return false;
}
// 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) {}
inline virtual void proc() const {
LocTimerDelegate* priorTop = mTimerContainer->getSoonestTimer();
if (NULL != ((LocHeap*)mTimerContainer)->remove((LocRankable&)*mTimer)) {
mTimerContainer->updateSoonestTime(priorTop);
// update soonest timer only if mTimer is actually removed from mTimerContainer
// 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;
}