From 5e633abcca598289d0423d89bb400b41e6417259 Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 15 Mar 2011 21:35:41 +0000 Subject: xserver libX11 libxcb mesa git update 15 Mar 2011 --- libX11/src/xcb_io.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'libX11/src/xcb_io.c') 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 -- cgit v1.2.3