Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
Make sure we don't end up with 0 threads if there's only 1 core
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyGalbreath committed Jul 3, 2023
1 parent 814653b commit 8ac7114
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/net/pl3x/map/core/Pl3xMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public ThreadFactory(@NotNull String name, int threads) {
}

public static @NotNull ExecutorService createService(@NotNull String name, int threads) {
int max = Runtime.getRuntime().availableProcessors() / 2;
int max = Math.max(1, Runtime.getRuntime().availableProcessors() / 2);
int parallelism = Mathf.clamp(1, max, threads < 1 ? max : threads);
return createService(new ThreadFactory(name, parallelism));
}
Expand Down

0 comments on commit 8ac7114

Please sign in to comment.