diff options
author | Yang Wang <KevinYang.Wang@amd.com> | 2023-03-09 10:38:15 +0800 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-05-03 19:21:17 +0000 |
commit | 11b17c1286afac0e6e399986df83721a4ea9487b (patch) | |
tree | 43d44cde688f0c34181c4c0d2699bd4de0c0f05b | |
parent | b1b97e8d348ed3ac9c9c422534bd47bc8fb2d31e (diff) | |
download | wayland-11b17c1286afac0e6e399986df83721a4ea9487b.tar.gz |
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>
-rw-r--r-- | src/event-loop.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/event-loop.c b/src/event-loop.c index dd9a971..c5cc34a 100644 --- a/src/event-loop.c +++ b/src/event-loop.c @@ -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) { |