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.
This commit is contained in:
Kristian Høgsberg 2012-06-08 16:54:52 -04:00
parent fc9c5e04fd
commit 70226bbda6
1 changed files with 2 additions and 0 deletions

View File

@ -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);
}