[PATCH] Cannot wait for user lock in sync_while_locked

Keith Packard keithp at keithp.com
Sat Mar 3 02:08:03 PST 2012


sync_while_locked grabs the user lock before performing the sync
operation. Telling InternalLockDisplay to wait for the user lock will
thus deadlock, so don't do that.

Signed-off-by: Keith Packard <keithp at keithp.com>
---

I don't know how this could ever have failed to deadlock --
sync_while_locked has called _XUserLockDisplay, and so locking_level
is non-zero. When _XInternalLockDisplay finds locking_level > 0, it
then calls _XDisplayLockWait, which is going to hang around for a
*very long time* as the lock is held by the current thread.

This patch fixes my application nicely, but I'd love to have someone
sanity check this...

 src/XlibInt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/XlibInt.c b/src/XlibInt.c
index a8f5d08..12b816f 100644
--- a/src/XlibInt.c
+++ b/src/XlibInt.c
@@ -214,7 +214,7 @@ void sync_while_locked(Display *dpy)
 #endif
     UnlockDisplay(dpy);
     SyncHandle();
-    InternalLockDisplay(dpy, /* don't skip user locks */ 0);
+    InternalLockDisplay(dpy, /* skip user locks */ 1);
 #ifdef XTHREADS
     if (dpy->lock)
         (*dpy->lock->user_unlock_display)(dpy);
-- 
1.7.9



More information about the xorg-devel mailing list