mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Fixes a deadlock issue in CraftScheduler
By: Raphfrk <raphfrk@gmail.com>
This commit is contained in:
parent
afd79ce40e
commit
85e1d48e88
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user