mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-26 02:19:19 +00:00
Allow watchdog thread to pass thread check
Similar as Paper # 12030, watchdog thread may also access chunks when server crashed by watchdog timeout We don't need to add same condition to isSameThreadFor used by PWT, since it already uses instanceOf to check is TickThread or not.
This commit is contained in:
@@ -3,6 +3,7 @@ package org.dreeam.leaf.world;
|
||||
import ca.spottedleaf.moonrise.common.util.TickThread;
|
||||
import it.unimi.dsi.fastutil.HashCommon;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import org.spigotmc.WatchdogThread;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.Future;
|
||||
@@ -182,11 +183,13 @@ public final class ChunkCache<V> {
|
||||
this.thread = Thread.currentThread();
|
||||
}
|
||||
|
||||
/// Checks if the current thread is the same as the owning thread.
|
||||
/// Checks if the current thread is the same as the owning thread,
|
||||
/// Or the watchdog thread on crash.
|
||||
///
|
||||
/// @return The current thread owns this map
|
||||
public boolean isSameThread() {
|
||||
return Thread.currentThread() == this.thread;
|
||||
Thread currThread = Thread.currentThread();
|
||||
return currThread == this.thread || currThread instanceof WatchdogThread;
|
||||
}
|
||||
|
||||
public boolean isSameThreadFor(ServerLevel serverLevel, int chunkX, int chunkZ) {
|
||||
|
||||
Reference in New Issue
Block a user