Bug: UpdateThreadExecutor blockt nun korrekt den Zeichenthread

This commit is contained in:
ngb
2022-07-18 22:47:37 +02:00
parent d34c60505e
commit 38d5f22fb6

View File

@@ -1638,7 +1638,7 @@ public class Zeichenmaschine extends Constants {
private Thread updateThread; private Thread updateThread;
private boolean running = false, waiting = false; private boolean running = false;
public UpdateThreadExecutor() { public UpdateThreadExecutor() {
super(1, 1, 0L, super(1, 1, 0L,
@@ -1646,13 +1646,18 @@ public class Zeichenmaschine extends Constants {
updateState = Options.AppState.IDLE; updateState = Options.AppState.IDLE;
} }
@Override
public void execute( Runnable command ) {
running = true;
super.execute(command);
}
@Override @Override
protected void beforeExecute( Thread t, Runnable r ) { protected void beforeExecute( Thread t, Runnable r ) {
// We store the one Thread this Executor holds // We store the one Thread this Executor holds,
// but it might change if a new Thread needed to be spawned // but it might change if a new Thread needed to be spawned
// due to en error. // due to en error.
updateThread = t; updateThread = t;
running = true;
} }
@Override @Override
@@ -1683,7 +1688,10 @@ public class Zeichenmaschine extends Constants {
* @return * @return
*/ */
public boolean isWaiting() { public boolean isWaiting() {
return running && updateThread.getState() == Thread.State.TIMED_WAITING; //return running && updateThread.getState() == Thread.State.TIMED_WAITING;
return running && updateThread != null && updateThread.getState() == Thread.State.TIMED_WAITING;
//|| updateThread.getState() == Thread.State.WAITING
//|| updateThread.getState() == Thread.State.BLOCKED;
} }
} }