linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #03194
[Bug 713742] Re: TimerManager generate double tick per second on some situations
Error in TimerManager. In some situations, it may lead to incorrect
operation of speed measuring devices, deadlock, division by zero, and
other troubles
ps: ADCH + + probably also contains the error, please fix it ;)
--
You received this bug notification because you are a member of
Dcplusplus-team, which is subscribed to DC++.
https://bugs.launchpad.net/bugs/713742
Title:
TimerManager generate double tick per second on some situations
Status in DC++:
Confirmed
Bug description:
Code to fix this error quote below:
int TimerManager::run()
{
int nextMin = 0;
ptime now = microsec_clock::universal_time();
ptime nextSecond = now + seconds(1);
while (!mtx.timed_lock(nextSecond))
{
const uint64_t t = getTick();
now = microsec_clock::universal_time();
nextSecond += seconds(1);
if (nextSecond < now)
{
nextSecond = now + seconds(1); // [!] IRainman fix TimerManager error: two tick generated in one second.
}
fire(TimerManagerListener::Second(), t);
if (nextMin++ >= 60)
{
fire(TimerManagerListener::Minute(), t);
nextMin = 0;
}
}
dcdebug("TimerManager done\n");
return 0;
}
autor FlylinkDC++ Team http://code.google.com/p/flylinkdc
References