diff options
author | Kevin Tang <zhikait@codeaurora.org> | 2015-09-15 19:02:58 -0700 |
---|---|---|
committer | Kevin Tang <zhikait@codeaurora.org> | 2015-09-18 09:30:33 -0700 |
commit | 088a127c3117c4b4b40d303a51b99d709062eef2 (patch) | |
tree | fd5ced163ce4b6ab6390bc6ab3323eac4c034349 /utils/LocTimer.cpp | |
parent | 9957a19f5f522d9e010020b5bcad3e91dfc599ca (diff) | |
download | gps-088a127c3117c4b4b40d303a51b99d709062eef2.tar.gz |
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
Diffstat (limited to 'utils/LocTimer.cpp')
-rw-r--r-- | utils/LocTimer.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/utils/LocTimer.cpp b/utils/LocTimer.cpp index 2d972c4..1699359 100644 --- a/utils/LocTimer.cpp +++ b/utils/LocTimer.cpp @@ -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; } |