Skip to content

Commit

Permalink
Use max_cpu when RUBY_MAX_CPU given
Browse files Browse the repository at this point in the history
  • Loading branch information
riseshia authored and ko1 committed Jan 1, 2024
1 parent ad2c95d commit 9368782
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions thread_pthread.c
Expand Up @@ -1685,8 +1685,11 @@ ruby_mn_threads_params(void)
const int default_max_cpu = 8; // TODO: CPU num?
int max_cpu = default_max_cpu;

if (USE_MN_THREADS && max_cpu_cstr && (max_cpu = atoi(max_cpu_cstr)) > 0) {
max_cpu = default_max_cpu;
if (USE_MN_THREADS && max_cpu_cstr) {
int given_max_cpu = atoi(max_cpu_cstr);
if (given_max_cpu > 0) {
max_cpu = given_max_cpu;
}
}

vm->ractor.sched.max_cpu = max_cpu;
Expand Down

0 comments on commit 9368782

Please sign in to comment.