mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 01:03:09 +00:00
Fix a bug in timer loop
Silly logic bug introduced in dda7de17e7
Timer thread, when msec = 0, instead of going
to sleep, calls check_time() in an endless loop.
Spotted and reported by snino64 due to abnormally
high CPU usage.
No functional change.
This commit is contained in:
parent
d1143794a0
commit
78a9531773
1 changed files with 3 additions and 2 deletions
|
@ -76,9 +76,10 @@ void TimerThread::idle_loop() {
|
|||
while (!do_exit)
|
||||
{
|
||||
mutex.lock();
|
||||
while (!msec && !do_exit)
|
||||
sleepCondition.wait_for(mutex, msec ? msec : INT_MAX);
|
||||
do sleepCondition.wait_for(mutex, msec ? msec : INT_MAX);
|
||||
while (!msec && !do_exit); // Don't allow wakeups when msec = 0
|
||||
mutex.unlock();
|
||||
|
||||
check_time();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue