Simplify tick loop

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-09-14 04:36:10 +02:00
parent 983850171b
commit 8fce62ccba

View File

@ -25,13 +25,10 @@ public final class TickThread extends Thread {
@Override @Override
public void run() { public void run() {
LockSupport.park(this);
while (!stop) { while (!stop) {
final Runnable localRunnable = tickRunnable; this.tickRunnable.run();
if (localRunnable != null) {
localRunnable.run();
this.tickRunnable = null;
this.phaser.arriveAndDeregister(); this.phaser.arriveAndDeregister();
}
LockSupport.park(this); LockSupport.park(this);
} }
} }