Commit 52b6f272 authored by Tatu Frisk's avatar Tatu Frisk Committed by Ross Burton
Browse files

Fix hanging issue in _XReply



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: default avatarTatu Frisk <tatu.frisk@ge.com>
Signed-off-by: default avatarJose Alarcon <jose.alarcon@ge.com>
parent d01d2337
Pipeline #369196 passed with stages
in 9 minutes and 44 seconds
...@@ -704,18 +704,14 @@ Status _XReply(Display *dpy, xReply *rep, int extra, Bool discard) ...@@ -704,18 +704,14 @@ Status _XReply(Display *dpy, xReply *rep, int extra, Bool discard)
if(dpy->xcb->event_owner == XlibOwnsEventQueue) if(dpy->xcb->event_owner == XlibOwnsEventQueue)
{ {
xcb_generic_reply_t *event; xcb_generic_reply_t *event;
/* If some thread is already waiting for events,
* it will get the first one. That thread must /* Assume event queue is empty if another thread is blocking
* process that event before we can continue. */ * waiting for event. */
/* FIXME: That event might be after this reply, if(!dpy->xcb->event_waiter)
* and might never even come--or there might be {
* multiple threads trying to get events. */ while((event = poll_for_response(dpy)))
while(dpy->xcb->event_waiter) handle_response(dpy, event, True);
{ /* need braces around ConditionWait */ }
ConditionWait(dpy, dpy->xcb->event_notify);
}
while((event = poll_for_event(dpy, True)))
handle_response(dpy, event, True);
} }
req->reply_waiter = 0; req->reply_waiter = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment