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:
parent
fc9c5e04fd
commit
70226bbda6
@ -318,7 +318,9 @@ clock_func(struct task *task, uint32_t events)
|
|||||||
{
|
{
|
||||||
struct panel_clock *clock =
|
struct panel_clock *clock =
|
||||||
container_of(task, struct panel_clock, clock_task);
|
container_of(task, struct panel_clock, clock_task);
|
||||||
|
uint64_t exp;
|
||||||
|
|
||||||
|
read(clock->clock_fd, &exp, sizeof exp);
|
||||||
if (panel_clock_tick(clock))
|
if (panel_clock_tick(clock))
|
||||||
widget_schedule_redraw(clock->widget);
|
widget_schedule_redraw(clock->widget);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user