timer bug fix

when a ticking timer is stopped, currently kernel doesn't
get updated with the next immediate timer's interval. As a
result, kernel timer will expire sooner (with the stopped
timer's interval), and the next timer's client is notified
for this expiration.

Change-Id: I0d67d1418cb9bfe7f70ae71252901d4c6bb699b3
CRs-Fixed: 909776
This commit is contained in:
Kevin Tang 2015-09-15 19:02:58 -07:00
parent 9957a19f5f
commit 088a127c31
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

@ -342,8 +342,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;
}