diff options
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -2620,6 +2620,8 @@ thread_mark(void *ptr) RUBY_MARK_UNLESS_NULL(th->locking_mutex); RUBY_MARK_UNLESS_NULL(th->name); + RUBY_MARK_UNLESS_NULL(th->scheduler); + RUBY_MARK_LEAVE("thread"); } @@ -2734,6 +2736,10 @@ th_init(rb_thread_t *th, VALUE self) th->self = self; rb_threadptr_root_fiber_setup(th); + /* All threads are blocking until a non-blocking fiber is scheduled */ + th->blocking = 1; + th->scheduler = Qnil; + if (self == 0) { size_t size = th->vm->default_params.thread_vm_stack_size / sizeof(VALUE); rb_ec_initialize_vm_stack(th->ec, ALLOC_N(VALUE, size), size); @@ -3294,12 +3300,14 @@ Init_VM(void) vm->self = TypedData_Wrap_Struct(rb_cRubyVM, &vm_data_type, vm); /* create main thread */ - th->self = TypedData_Wrap_Struct(rb_cThread, &thread_data_type, th); + th->self = TypedData_Wrap_Struct(rb_cThread, &thread_data_type, th); + vm->main_thread = th; vm->running_thread = th; th->vm = vm; th->top_wrapper = 0; th->top_self = rb_vm_top_self(); + rb_thread_set_current(th); rb_vm_living_threads_insert(vm, th); |