From 4467146d33bdacddf769310103cb7330c25424c5 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 11 Jun 2017 05:06:21 -0400 Subject: [PATCH] v0.6.0b: removed usage of thread state checking logic, too unreliable --- .../scenes/GameScene.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 2c2a7de49..3e2e41c91 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -417,20 +417,20 @@ public class GameScene extends PixelScene { //tell the actor thread to finish, then wait for it to complete any actions it may be doing. if (actorThread.isAlive()){ synchronized (GameScene.class){ - synchronized (actorThread) { - actorThread.interrupt(); + synchronized (actorThread) { + actorThread.interrupt(); + } + try { + GameScene.class.wait(5000); + } catch (InterruptedException e) { + ShatteredPixelDungeon.reportException(e); + } + synchronized (actorThread) { + if (Actor.processing()) { + Throwable t = new Throwable(); + t.setStackTrace(actorThread.getStackTrace()); + throw new RuntimeException("timeout waiting for actor thread! ", t); } - try { - GameScene.class.wait(5000); - } catch (InterruptedException e) { - ShatteredPixelDungeon.reportException(e); - } - synchronized (actorThread) { - if (actorThread.getState() != Thread.State.WAITING) { - Throwable t = new Throwable(); - t.setStackTrace(actorThread.getStackTrace()); - throw new RuntimeException("timeout waiting for actor thread! ", t); - } } } }