summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAwais Belal <awais_belal@mentor.com>2015-10-12 07:32:37 -0600
committerBrian Paul <brianp@vmware.com>2015-10-14 08:17:53 -0600
commit2b304e765695d385fd3bf414e6e444020bedb0a8 (patch)
tree2be0b5abce02a10960983f3a47d222520ec808e0
parent74443c6ee79f3251f643ea05e94df58183e37d0d (diff)
downloadmesa-demos-2b304e765695d385fd3bf414e6e444020bedb0a8.zip
mesa-demos-2b304e765695d385fd3bf414e6e444020bedb0a8.tar.xz
sharedtex_mt: fix rendering thread hang
XNextEvent is a blocking call which locks up the display mutex. This causes the rendering threads to hang when they call glXSwapBuffers() as that tries to take the same mutex in underlying calls through XCopyArea(). So we only call XNextEvent when it has at least one event so we don't lock indefinitely. Patch slightly fixed by Brian to keep var declarations as-is and clean up the patch description. Signed-off-by: Awais Belal <awais_belal@mentor.com> Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--src/xdemos/sharedtex_mt.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/xdemos/sharedtex_mt.c b/src/xdemos/sharedtex_mt.c
index a90903a..2068d4b 100644
--- a/src/xdemos/sharedtex_mt.c
+++ b/src/xdemos/sharedtex_mt.c
@@ -423,6 +423,13 @@ EventLoop(void)
while (1) {
int i;
XEvent event;
+
+ /* Do we have an event? */
+ if (XPending(gDpy) == 0) {
+ usleep(10000);
+ continue;
+ }
+
XNextEvent(gDpy, &event);
for (i = 0; i < NumWindows; i++) {
struct window *h = &Windows[i];