PTimer speed improvement
Brought to you by:
csoutheren,
rjongbloed
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);
}
}
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.