13
0
geforkt von Mirrors/Paper

Fixes a deadlock issue in CraftScheduler

Dieser Commit ist enthalten in:
Raphfrk 2011-02-13 03:45:34 +00:00 committet von EvilSeph
Ursprung 40f7986a11
Commit 9715e77852

Datei anzeigen

@ -20,6 +20,7 @@ public class CraftScheduler implements BukkitScheduler, Runnable {
private final CraftThreadManager craftThreadManager = new CraftThreadManager();
private final LinkedList<Runnable> mainThreadQueue = new LinkedList<Runnable>();
private final LinkedList<Runnable> syncedTasks = new LinkedList<Runnable>();
private final TreeMap<CraftTask,Boolean> schedulerQueue = new TreeMap<CraftTask,Boolean>();
@ -111,11 +112,14 @@ public class CraftScheduler implements BukkitScheduler, Runnable {
try {
this.currentTick = currentTick;
while (!mainThreadQueue.isEmpty()) {
mainThreadQueue.removeFirst().run();
syncedTasks.addLast(mainThreadQueue.removeFirst());
}
} finally {
mainThreadLock.unlock();
}
while(!syncedTasks.isEmpty()) {
syncedTasks.removeFirst().run();
}
}
}