diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-06-08 16:54:52 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-06-08 16:54:52 -0400 |
commit | 70226bbda669b0542b222fd42de963eefddc9a7a (patch) | |
tree | f0356e9da974ffe95daeb88a31c11b8acc76ef9a | |
parent | fc9c5e04fd0393bcfa1dbf349cb38e52f2c42728 (diff) |
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.
-rw-r--r-- | 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); } |