aboutsummaryrefslogtreecommitdiff
path: root/libX11/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-15 21:35:41 +0000
committermarha <marha@users.sourceforge.net>2011-03-15 21:35:41 +0000
commit5e633abcca598289d0423d89bb400b41e6417259 (patch)
tree74258f0d1f9f5f2b171d16fd9654a13803216c6f /libX11/src
parentb5d1fd89898edb34f73679b542c754d837d44cf8 (diff)
downloadvcxsrv-5e633abcca598289d0423d89bb400b41e6417259.tar.gz
vcxsrv-5e633abcca598289d0423d89bb400b41e6417259.tar.bz2
vcxsrv-5e633abcca598289d0423d89bb400b41e6417259.zip
xserver libX11 libxcb mesa git update 15 Mar 2011
Diffstat (limited to 'libX11/src')
-rw-r--r--libX11/src/xcb_io.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libX11/src/xcb_io.c b/libX11/src/xcb_io.c
index 13c709f2f..afb0267ca 100644
--- a/libX11/src/xcb_io.c
+++ b/libX11/src/xcb_io.c
@@ -340,7 +340,15 @@ void _XReadEvents(Display *dpy)
dpy->xcb->event_waiter = 1;
UnlockDisplay(dpy);
event = xcb_wait_for_event(dpy->xcb->connection);
- InternalLockDisplay(dpy, /* don't skip user locks */ 0);
+ /* It appears that classic Xlib respected user
+ * locks when waking up after waiting for
+ * events. However, if this thread did not have
+ * any user locks, and another thread takes a
+ * user lock and tries to read events, then we'd
+ * deadlock. So we'll choose to let the thread
+ * that got in first consume events, despite the
+ * later thread's user locks. */
+ InternalLockDisplay(dpy, /* ignore user locks */ 1);
dpy->xcb->event_waiter = 0;
ConditionBroadcast(dpy, dpy->xcb->event_notify);
if(!event)
@@ -531,7 +539,10 @@ Status _XReply(Display *dpy, xReply *rep, int extra, Bool discard)
req->reply_waiter = 1;
UnlockDisplay(dpy);
response = xcb_wait_for_reply(c, req->sequence, &error);
- InternalLockDisplay(dpy, /* don't skip user locks */ 0);
+ /* Any user locks on another thread must have been taken
+ * while we slept in xcb_wait_for_reply. Classic Xlib
+ * ignored those user locks in this case, so we do too. */
+ InternalLockDisplay(dpy, /* ignore user locks */ 1);
/* We have the response we're looking for. Now, before
* letting anyone else process this sequence number, we