event-loop: optimize timer check logic

the 'has_timers' flag can be returned directly without having to track all the ready events
when a timer is found ready.

Signed-off-by: Yang Wang <KevinYang.Wang@amd.com>
This commit is contained in:
Yang Wang 2023-03-09 10:38:15 +08:00 committed by Simon Ser
parent b1b97e8d34
commit 11b17c1286

View file

@ -1082,8 +1082,10 @@ wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout)
for (i = 0; i < count; i++) {
source = ep[i].data.ptr;
if (source == &loop->timers.base)
if (source == &loop->timers.base) {
has_timers = true;
break;
}
}
if (has_timers) {