summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorRaphfrk <raphfrk@gmail.com>2011-02-13 03:45:34 +0000
committerEvilSeph <evilseph@unaligned.org>2011-02-13 00:55:58 -0500
commit9715e778526f18dbe9f3e304e6d30beef701ea09 (patch)
treec654d02df14ddd5d0a58873b77c5a5b2976f09a6 /src/main/java/org
parent40f7986a110c31d857d2cc7a7f7a802e619faf99 (diff)
downloadcraftbukkit-9715e778526f18dbe9f3e304e6d30beef701ea09.tar
craftbukkit-9715e778526f18dbe9f3e304e6d30beef701ea09.tar.gz
craftbukkit-9715e778526f18dbe9f3e304e6d30beef701ea09.tar.lz
craftbukkit-9715e778526f18dbe9f3e304e6d30beef701ea09.tar.xz
craftbukkit-9715e778526f18dbe9f3e304e6d30beef701ea09.zip
Fixes a deadlock issue in CraftScheduler
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index d50a036e..edf5bae8 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -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();
+ }
}
}