Re: EXT: Re: [PATCH xcb] Fix hanging issue in _XReply

2018-02-27 Thread Ray, Ian (GE Healthcare)

> On 19 Feb 2018, at 17.46, Arthur Huillet  wrote:
> 
> No opinion on the patch, but do you have a small reproducer app to expose the 
> problem?
> I've debugged something similar in the past, without much success (or 
> interest).
> 

Unfortunately not, I will try to put something together.


> Thanks,
> -- 
> A. Huillet

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xcb] Fix hanging issue in _XReply

2018-02-19 Thread Arthur Huillet
No opinion on the patch, but do you have a small reproducer app to 
expose the problem?
I've debugged something similar in the past, without much success (or 
interest).


Thanks,
--
A. Huillet
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xcb] Fix hanging issue in _XReply

2018-02-14 Thread Adam Jackson
On Fri, 2018-01-05 at 16:49 +0200, Ian Ray wrote:
> From: Tatu Frisk 
> 
> Assume event queue is empty if another thread is blocking waiting for event.
> 
> If one thread was blocking waiting for an event and another thread sent a
> reply to the X server, both threads got blocked until an event was
> received.
> 
> Signed-off-by: Tatu Frisk 
> Signed-off-by: Jose Alarcon 
> Signed-off-by: Ian Ray 

I came across this patch again today. It looks correct to me but I
don't claim to fully understand libX11; it would be nice if an xcb
expert could take a look.

- ajax

>  src/xcb_io.c | 18 +++---
>  1 file changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/src/xcb_io.c b/src/xcb_io.c
> index 649c820..4a8bb27 100644
> --- a/src/xcb_io.c
> +++ b/src/xcb_io.c
> @@ -607,18 +607,14 @@ Status _XReply(Display *dpy, xReply *rep, int extra, 
> Bool discard)
>   if(dpy->xcb->event_owner == XlibOwnsEventQueue)
>   {
>   xcb_generic_reply_t *event;
> - /* If some thread is already waiting for events,
> -  * it will get the first one. That thread must
> -  * process that event before we can continue. */
> - /* FIXME: That event might be after this reply,
> -  * and might never even come--or there might be
> -  * multiple threads trying to get events. */
> - while(dpy->xcb->event_waiter)
> - { /* need braces around ConditionWait */
> - ConditionWait(dpy, dpy->xcb->event_notify);
> +
> + /* Assume event queue is empty if another thread is 
> blocking
> +  * waiting for event. */
> + if(!dpy->xcb->event_waiter)
> + {
> + while((event = poll_for_response(dpy)))
> + handle_response(dpy, event, True);
>   }
> - while((event = poll_for_event(dpy)))
> - handle_response(dpy, event, True);
>   }
>  
>   req->reply_waiter = 0;
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel