mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-06 15:31:43 +01:00
Fast exit if task queue is empty
This commit is contained in:
parent
5c6d0dc7b2
commit
9af41f944a
@ -53,6 +53,7 @@ final class SchedulerImpl implements Scheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Run all tasks lock-free, either in the current thread or pool
|
// Run all tasks lock-free, either in the current thread or pool
|
||||||
|
if (!taskQueue.isEmpty()) {
|
||||||
this.taskQueue.drain(task -> {
|
this.taskQueue.drain(task -> {
|
||||||
if (!task.isAlive()) return;
|
if (!task.isAlive()) return;
|
||||||
switch (task.executionType()) {
|
switch (task.executionType()) {
|
||||||
@ -61,6 +62,7 @@ final class SchedulerImpl implements Scheduler {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Task submitTask(@NotNull Supplier<TaskSchedule> task,
|
public @NotNull Task submitTask(@NotNull Supplier<TaskSchedule> task,
|
||||||
|
Loading…
Reference in New Issue
Block a user