From 70226bbda669b0542b222fd42de963eefddc9a7a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 8 Jun 2012 16:54:52 -0400 Subject: [PATCH] clock: Read fd to avoid 100% cpu usage 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 file changed, 2 insertions(+) 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); } -- 2.7.4