Fix [Bug #20779] Dedicated native thread creation failed bug
When a dedicated native thread fails to create (OS can't create more threads), don't add the ruby-level thread to the thread scheduler. If it's added, then next time the thread is scheduled to run it will sleep forever, waiting for a native thread that doesn't exist to pick it up.
This commit is contained in:
parent
9e0eb9778d
commit
2a08f7283e
Notes:
git
2024-12-24 00:06:07 +00:00
@ -2151,10 +2151,13 @@ native_thread_create_dedicated(rb_thread_t *th)
|
|||||||
rb_ec_initialize_vm_stack(th->ec, vm_stack, vm_stack_word_size);
|
rb_ec_initialize_vm_stack(th->ec, vm_stack, vm_stack_word_size);
|
||||||
th->sched.context_stack = vm_stack;
|
th->sched.context_stack = vm_stack;
|
||||||
|
|
||||||
|
|
||||||
|
int err = native_thread_create0(th->nt);
|
||||||
|
if (!err) {
|
||||||
// setup
|
// setup
|
||||||
thread_sched_to_ready(TH_SCHED(th), th);
|
thread_sched_to_ready(TH_SCHED(th), th);
|
||||||
|
}
|
||||||
return native_thread_create0(th->nt);
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user