[Xcb] [PATCH xcb] Check for POLLERR, POLLHUP, and POLLNVAL in _xcb_conn_wait.

Jamey Sharp jamey at minilop.net
Sun Jul 11 03:10:35 PDT 2010


Thanks Aaron! A different patch was recently submitted for this, but I
think perhaps I like yours better. It's a bit simpler.

Would it make sense to test whether fd.revents contains
~(POLLIN|POLLOUT) instead?

Jamey

On Sat, Jul 10, 2010 at 11:24 PM, Aaron Plattner <aplattner at nvidia.com> wrote:
> Fixes the XTS XConnectionNumber test.
>
> This test creates a display connection, closes its file descriptor, tries to
> send a no-op, and then expects an error.  XCB just goes into an infinite loop
> because poll() returns immediately with POLLNVAL set.
>
> Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
> ---
>  src/xcb_conn.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/src/xcb_conn.c b/src/xcb_conn.c
> index 50a662b..6a07730 100644
> --- a/src/xcb_conn.c
> +++ b/src/xcb_conn.c
> @@ -337,6 +337,16 @@ int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vec
>         if(FD_ISSET(c->fd, &wfds))
>  #endif
>             ret = ret && write_vec(c, vector, count);
> +
> +#if USE_POLL
> +        if((fd.revents & (POLLERR |
> +                          POLLHUP |
> +                          POLLNVAL)))
> +        {
> +            _xcb_conn_shutdown(c);
> +            ret = 0;
> +        }
> +#endif
>     }
>
>     if(count)
> --
> 1.7.0.4
>
>
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
>


More information about the Xcb mailing list