[PATCH wayland v2 5/8] client: Fully flush during blocking dispatch

Daniel Stone daniel at fooishbar.org
Tue Dec 29 03:07:55 PST 2015


Hi Jonas,

On 29 December 2015 at 02:10, Jonas Ã…dahl <jadahl at gmail.com> wrote:
> @@ -1485,27 +1500,28 @@ WL_EXPORT int
>  wl_display_dispatch_queue(struct wl_display *display,
>                           struct wl_event_queue *queue)
>  {
> -       struct pollfd pfd[2];
>         int ret;
>
>         if (wl_display_prepare_read_queue(display, queue) == -1)
>                 return wl_display_dispatch_queue_pending(display, queue);
>
> +       do {
> +               if (wl_display_poll(display, POLLOUT) == -1) {
> +                       wl_display_cancel_read(display);
> +                       return -1;
> +               }
> +
> +               ret = wl_display_flush(display);
> +       } while (ret == -1 && errno == EAGAIN);

Hm, this now unconditionally incurs an extra syscall for the poll.
Could you please flip those so we try to flush first and then only
poll if we couldn't complete the flush, avoiding the extra poll for
the common case of the output buffer not being full?

Cheers,
Daniel


More information about the wayland-devel mailing list