mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Don't change vm_stack/cfp without acquiring gvl first.
This commit is contained in:
parent
ab6d8d0b65
commit
2abe548f35
1 changed files with 4 additions and 1 deletions
5
thread.c
5
thread.c
|
@ -714,6 +714,10 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start)
|
||||||
}
|
}
|
||||||
|
|
||||||
vm_stack = alloca(size * sizeof(VALUE));
|
vm_stack = alloca(size * sizeof(VALUE));
|
||||||
|
VM_ASSERT(vm_stack);
|
||||||
|
|
||||||
|
gvl_acquire(th->vm, th);
|
||||||
|
|
||||||
rb_ec_initialize_vm_stack(th->ec, vm_stack, size);
|
rb_ec_initialize_vm_stack(th->ec, vm_stack, size);
|
||||||
|
|
||||||
ruby_thread_set_native(th);
|
ruby_thread_set_native(th);
|
||||||
|
@ -723,7 +727,6 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start)
|
||||||
|
|
||||||
thread_debug("thread start: %p\n", (void *)th);
|
thread_debug("thread start: %p\n", (void *)th);
|
||||||
|
|
||||||
gvl_acquire(th->vm, th);
|
|
||||||
{
|
{
|
||||||
thread_debug("thread start (get lock): %p\n", (void *)th);
|
thread_debug("thread start (get lock): %p\n", (void *)th);
|
||||||
rb_thread_set_current(th);
|
rb_thread_set_current(th);
|
||||||
|
|
Loading…
Add table
Reference in a new issue