#219 PTimer speed improvement

closed-accepted
nobody
PTLib (107)
5
2012-12-19
2012-12-18
No

I've found that synchronous stopping of PTimer in PTimer::StartRunning takes too much time, so threads that just want to restart timer wait too long while locking shared resources.
It can be improved using Stop(false); instead of Stop(true);

void PTimer::StartRunning(PBoolean once)
{
Stop(false);

PTimeInterval::operator=(m_resetTime);
m_oneshot = once;

if (m_resetTime > 0) {
m_absoluteTime = Tick().GetMilliSeconds() + m_resetTime.GetMilliSeconds();
m_timerList->QueueRequest(PTimerList::RequestType::Start, this, false);
}
}

Discussion

  • Robert Jongbloed

    • status: open --> closed-accepted
     
  • Robert Jongbloed

    A have applied the patch to Eridani, but I have to say it worries me greatly that it will allow new race conditions to become possible.

     

Log in to post a comment.