MT#40962 increase idle sleep time

If there are no timers then it makes no senes to process ticks in real
time. Sleep up to 0.5 seconds in that case. When timers are added we
are immediately woken up through the conditional variable. Only setting
the shutdown flag would not wake up the thread, but a sleep time of half
a second should be an acceptable delay for shutdowns.

Analogous to 695d902841

Change-Id: I37adf078825470af99e6a7755df3d8786d3eeaa6
mr12.3.1
Richard Fuchs 2 years ago
parent 390bf441cf
commit 84fc2cc789

@ -91,9 +91,13 @@ void _wheeltimer::run()
if(now < next_tick){
diff = next_tick - now;
// Sleep up to diff ms, but wake up early if something is added to reqs_backlog
reqs_cond.wait_for_to(diff / 1000);
// Sleep up to diff ms OR up to 0.5 seconds if there are no timers,
// but wake up early if something is added to reqs_backlog
if (num_timers)
reqs_cond.wait_for_to(diff / 1000);
else
reqs_cond.wait_for_to(500); // 0.5 s
}
//else {
//printf("missed one tick\n");

Loading…
Cancel
Save