diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2015-05-01 09:09:38 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2015-05-01 09:09:38 +1000 |
commit | c2ef1854d82ebd6f484c59759f69dd30b4b3593b (patch) | |
tree | 9b485fdf8d268e2788246df0014cc20e37e934ba | |
parent | 28ed7a62653f1e257bba22b792ec785e9200d40e (diff) |
timer: set O_NONBLOCK on the timerfd
Resetting a timerfd empties the data on the fd, so if the timer is reset
between triggering and us reading it, we may block trying to read it.
Since we read events off a device in a loop, a device sending a continuous
flow of events may cause the timer to trigger but delay reading it. If one of
the events cause e.g. the tap timer to be set, the timerfd may be empty at the
time of reading.
Suggested-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/timer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/timer.c b/src/timer.c index 285f75b..114a649 100644 --- a/src/timer.c +++ b/src/timer.c @@ -122,7 +122,8 @@ libinput_timer_handler(void *data) int libinput_timer_subsys_init(struct libinput *libinput) { - libinput->timer.fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); + libinput->timer.fd = timerfd_create(CLOCK_MONOTONIC, + TFD_CLOEXEC | TFD_NONBLOCK); if (libinput->timer.fd < 0) return -1; |