Skip to content

Commit

Permalink
Make sure we assume 1 core on faulty info
Browse files Browse the repository at this point in the history
It appears that some OS's at the moment report 0 for nqp::cpucores.
Other places in the code already make sure there is at least 1 core.
It seemed appropriate to do the same check for the ThreadPoolScheduler.
  • Loading branch information
lizmat committed Feb 16, 2020
1 parent 246f20d commit 1a7f16b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core.c/ThreadPoolScheduler.pm6
Expand Up @@ -589,7 +589,7 @@ my class ThreadPoolScheduler does Scheduler {

my @last-utils = 0e0 xx NUM_SAMPLES;
#?endif
my int $cpu-cores = nqp::cpucores();
my int $cpu-cores = max(nqp::cpucores() - 1,1);

# These definitions used to live inside the supervisor loop.
# Moving them out of the loop does not improve CPU usage
Expand Down

0 comments on commit 1a7f16b

Please sign in to comment.