summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-04 02:00:13 -0800
committerKeith Packard <keithp@keithp.com>2012-03-13 23:34:18 -0700
commita4c591ced5cac9301b9abfa0e521be2d0b267882 (patch)
tree39b3dafca65db29ee860204320367a278ccdd0fc
parented00b460acb08787b695f27b864e96102dfd4867 (diff)
Block for other threads in _XUserLockDisplay
Wait for all other threads to release the user-level lock when acquiring it. This ensures that only one thread at a time holds the user-level lock, necessary as it is a nesting lock and a single variable is used to determine when the lock is nesting and when it is contended. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
-rw-r--r--src/locking.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/locking.c b/src/locking.c
index 4f9a40fb..b3dfb3b0 100644
--- a/src/locking.c
+++ b/src/locking.c
@@ -486,6 +486,8 @@ static void _XInternalLockDisplay(
static void _XUserLockDisplay(
register Display* dpy)
{
+ _XDisplayLockWait(dpy);
+
if (++dpy->lock->locking_level == 1) {
dpy->lock->lock_wait = _XDisplayLockWait;
dpy->lock->locking_thread = xthread_self();