[PATCH 3/3] client: cancel read in wl_display_read_events() when last_error is set

Jason Ekstrand jason at jlekstrand.net
Thu Sep 11 09:41:30 PDT 2014


I took a look at it too and it looks good to me
--Jason

On Thu, Sep 11, 2014 at 1:46 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:

> On Wed, 10 Sep 2014 12:47:14 +0200
> Marek Chalupa <mchqwerty at gmail.com> wrote:
>
> > Calling wl_display_read_events() after an error should be equivalent
> > to wl_display_cancel_read(), so that display state is consistent.
> >
> > Thanks to Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> > for pointing that out.
> >
> > Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
> > ---
> >  src/wayland-client.c | 13 ++++++++++---
> >  1 file changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/wayland-client.c b/src/wayland-client.c
> > index 1b7a046..b0f77b9 100644
> > --- a/src/wayland-client.c
> > +++ b/src/wayland-client.c
> > @@ -1192,6 +1192,14 @@ read_events(struct wl_display *display)
> >       return 0;
> >  }
> >
> > +static void
> > +cancel_read(struct wl_display *display)
> > +{
> > +     display->reader_count--;
> > +     if (display->reader_count == 0)
> > +             display_wakeup_threads(display);
> > +}
> > +
> >  /** Read events from display file descriptor
> >   *
> >   * \param display The display context object
> > @@ -1219,6 +1227,7 @@ wl_display_read_events(struct wl_display *display)
> >       pthread_mutex_lock(&display->mutex);
> >
> >       if (display->last_error) {
> > +             cancel_read(display);
> >               pthread_mutex_unlock(&display->mutex);
> >
> >               errno = display->last_error;
> > @@ -1365,9 +1374,7 @@ wl_display_cancel_read(struct wl_display *display)
> >  {
> >       pthread_mutex_lock(&display->mutex);
> >
> > -     display->reader_count--;
> > -     if (display->reader_count == 0)
> > -             display_wakeup_threads(display);
> > +     cancel_read(display);
> >
> >       pthread_mutex_unlock(&display->mutex);
> >  }
>
> All three pushed.
>
>
> Thanks,
> pq
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140911/1d3e3e07/attachment.html>


More information about the wayland-devel mailing list