mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-29 12:37:42 +01:00
Prevent TickThreads from stopping if something weird happens
This commit is contained in:
parent
e97f1db184
commit
1d8addaea6
@ -36,14 +36,20 @@ public final class TickThread extends Thread {
|
|||||||
public void run() {
|
public void run() {
|
||||||
LockSupport.park(this);
|
LockSupport.park(this);
|
||||||
while (!stop) {
|
while (!stop) {
|
||||||
tick();
|
this.lock.lock();
|
||||||
|
try {
|
||||||
|
tick();
|
||||||
|
} catch (Exception e) {
|
||||||
|
MinecraftServer.getExceptionManager().handleException(e);
|
||||||
|
}
|
||||||
|
this.lock.unlock();
|
||||||
|
// #acquire() callbacks
|
||||||
this.phaser.arriveAndDeregister();
|
this.phaser.arriveAndDeregister();
|
||||||
LockSupport.park(this);
|
LockSupport.park(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tick() {
|
private void tick() {
|
||||||
this.lock.lock();
|
|
||||||
for (ThreadDispatcher.ChunkEntry entry : entries) {
|
for (ThreadDispatcher.ChunkEntry entry : entries) {
|
||||||
final Chunk chunk = entry.chunk();
|
final Chunk chunk = entry.chunk();
|
||||||
try {
|
try {
|
||||||
@ -67,8 +73,6 @@ public final class TickThread extends Thread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.lock.unlock();
|
|
||||||
// #acquire() callbacks
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void startTick(long tickTime) {
|
void startTick(long tickTime) {
|
||||||
|
Loading…
Reference in New Issue
Block a user