mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
introduce rb_ractor_atfork()
to reset main ractor at fork().
This commit is contained in:
parent
7fcb6b3dbe
commit
7340e7f827
3 changed files with 22 additions and 5 deletions
18
ractor.c
18
ractor.c
|
@ -1477,6 +1477,24 @@ rb_ractor_main_alloc(void)
|
|||
return r;
|
||||
}
|
||||
|
||||
#if defined(HAVE_WORKING_FORK)
|
||||
void
|
||||
rb_ractor_atfork(rb_vm_t *vm, rb_thread_t *th)
|
||||
{
|
||||
// initialize as a main ractor
|
||||
vm->ractor.cnt = 0;
|
||||
vm->ractor.blocking_cnt = 0;
|
||||
ruby_single_main_ractor = th->ractor;
|
||||
th->ractor->status_ = ractor_created;
|
||||
|
||||
rb_ractor_living_threads_init(th->ractor);
|
||||
rb_ractor_living_threads_insert(th->ractor, th);
|
||||
|
||||
VM_ASSERT(vm->ractor.blocking_cnt == 0);
|
||||
VM_ASSERT(vm->ractor.cnt == 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
void rb_gvl_init(rb_global_vm_lock_t *gvl);
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue