summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorKoichi Sasada <[email protected]>2023-10-17 09:51:53 +0900
committerKoichi Sasada <[email protected]>2023-10-17 17:43:52 +0900
commitc9990c8d0fdec0f79791ac3096ee6925fab0be7c ()
treef79a6bc857be964eaa3407146b776f4b545efd6a /thread_pthread.c
parentaee1bfd88eca8fb9022138347b7c0390c0e6f545 (diff)
"+MN" in description
If `RUBY_MN_THREADS=1` is given, this shows `+MN` in `RUBY_DESCRIPTION` like: ``` $ RUBY_MN_THREADS=1 ./miniruby --yjit -v ruby 3.3.0dev (2023-10-17T04:10:14Z master 908f8fffa2) +YJIT +MN [x86_64-linux] ``` Before this , a warning is displayed if `$VERBOSE` is given. However it can make troubles with tests (with `$VERBOSE`), do not show any warning with a MN threads configuration.
-rw-r--r--thread_pthread.c35
1 files changed, 9 insertions, 26 deletions
@@ -1626,6 +1626,8 @@ Init_native_thread(rb_thread_t *main_th)
vm->ractor.sched.dnt_cnt = 1;
}
void
ruby_mn_threads_params(void)
{
@@ -1633,38 +1635,19 @@ ruby_mn_threads_params(void)
rb_ractor_t *main_ractor = GET_RACTOR();
const char *mn_threads_cstr = getenv("RUBY_MN_THREADS");
- bool enable_mn_threads;
- if (mn_threads_cstr && (enable_mn_threads = atoi(mn_threads_cstr) > 0)) {
-#if USE_MN_THREADS
- if (RTEST(ruby_verbose)) {
- fprintf(stderr, "RUBY_MN_THREADS = %s (default: 0)\n", mn_threads_cstr);
- }
-#else
- enable_mn_threads = false;
- if (RTEST(ruby_verbose)) {
- fprintf(stderr, "RUBY_MN_THREADS = %s is specified, but MN threads are not implemented on this executable.", mn_threads_cstr);
- }
-#endif
- }
- else {
- enable_mn_threads = false; // default: off on main Ractor
}
main_ractor->threads.sched.enable_mn_threads = enable_mn_threads;
const char *max_cpu_cstr = getenv("RUBY_MAX_CPU");
const int default_max_cpu = 8; // TODO: CPU num?
- int max_cpu;
- if (max_cpu_cstr && (max_cpu = atoi(max_cpu_cstr)) > 0) {
- if (RTEST(ruby_verbose)) {
-#if USE_MN_THREADS
- fprintf(stderr, "RUBY_MAX_CPU = %d (default: %d)\n", max_cpu, default_max_cpu);
-#else
- fprintf(stderr, "RUBY_MAX_CPU = %d is specified, but MN threads are not implemented on this executable.", max_cpu);
-#endif
- }
- }
- else {
max_cpu = default_max_cpu;
}