#1503: Simplify CAS loop to getAndSet

By: sunmisc <jolyjdia@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2024-11-23 21:12:04 +11:00
parent 0f66e39e46
commit 5a6e315a79

View file

@ -444,11 +444,7 @@ public class CraftScheduler implements BukkitScheduler {
}
private void addTask(final CraftTask task) {
final AtomicReference<CraftTask> tail = this.tail;
CraftTask tailTask = tail.get();
while (!tail.compareAndSet(tailTask, task)) {
tailTask = tail.get();
}
final CraftTask tailTask = this.tail.getAndSet(task);
tailTask.setNext(task);
}