[PATCH libinput] timer: drain data on the timerfd when it triggers

Hans de Goede hdegoede at redhat.com
Thu Apr 30 00:38:49 PDT 2015


Hi,

On 30-04-15 03:33, Peter Hutterer wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>


It seems this is the right thing todo:

Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans


> ---
> I admit, I'm not sure of the effect it has leaving the data sitting there.
> timerfd_create states that only the value read changes, not the actual size
> of the data (which I couldn't reproduce in a quick test, it's always 1)
> epoll sounds like it should keep triggering as long as data is sitting there
> but it doesn't. Didn't have time to investigate further, so here's the patch
> for what seems to be the correct thing to do.
>
>   src/timer.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/src/timer.c b/src/timer.c
> index f6c8e42..285f75b 100644
> --- a/src/timer.c
> +++ b/src/timer.c
> @@ -101,6 +101,9 @@ libinput_timer_handler(void *data)
>   	struct libinput *libinput = data;
>   	struct libinput_timer *timer, *tmp;
>   	uint64_t now;
> +	uint64_t discard;
> +
> +	read(libinput->timer.fd, &discard, sizeof(discard));
>
>   	now = libinput_now(libinput);
>   	if (now == 0)
>


More information about the wayland-devel mailing list