aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2016-08-22 21:53:49 -0700
committerJorim Jaggi <jjaggi@google.com>2016-08-23 18:34:28 +0000
commitc9f4debdb17e1f3b9fca74a03f6593c12aa9327d (patch)
tree843a0070ff79c81abc9074d77ff8438bf305b084
parentee129dc3b72eea30b620b791a58071af1b0eb0da (diff)
downloadlibgdx-c9f4debdb17e1f3b9fca74a03f6593c12aa9327d.tar.gz
There was a race condition between the GL thread and the main thread. If GL thread was much quicker because of scheduling delays, GL thread already drew the first frame before main thread was reaching resume(). In that case, synch.wait() will just hang because nobody else requested a frame because the rendering was set to on-demand. Now, we explicitely request a frame after setting resume=true so we can make sure a frame gets scheduled with resume=true so we get notified on the synch. Change-Id: Id98c9489011d39c6472a98f3e4cb1bfc7b0596ff Fixes: 30967728
-rw-r--r--backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGraphicsLiveWallpaper.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGraphicsLiveWallpaper.java b/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGraphicsLiveWallpaper.java
index 5fcd0e421..0cb036837 100644
--- a/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGraphicsLiveWallpaper.java
+++ b/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGraphicsLiveWallpaper.java
@@ -136,6 +136,7 @@ public final class AndroidGraphicsLiveWallpaper extends AndroidGraphics {
// by jw: added synchronization, there was nothing before
while (resume) {
try {
+ requestRendering();
synch.wait();
} catch (InterruptedException ignored) {
Gdx.app.log("AndroidGraphics", "waiting for resume synchronization failed!");