[PATCH] clock: Read fd to avoid 100% cpu usage
Martin Minarik
minarik11 at student.fiit.stuba.sk
Fri Jun 8 13:27:19 PDT 2012
In clock_func() it is necessary to read the timer fd, or
it will stay readable, and the event loop will call the function again.
That causes an endless loop.
---
clients/desktop-shell.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 3e014cc..ae8e5f0 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -318,7 +318,9 @@ clock_func(struct task *task, uint32_t events)
{
struct panel_clock *clock =
container_of(task, struct panel_clock, clock_task);
+ uint64_t exp;
+ read(clock->clock_fd, &exp, sizeof exp);
if (panel_clock_tick(clock))
widget_schedule_redraw(clock->widget);
}
--
1.7.5.4
More information about the wayland-devel
mailing list