diff --git a/thread.c b/thread.c index f2dd417297..2f5e279e52 100644 --- a/thread.c +++ b/thread.c @@ -424,13 +424,6 @@ rb_vm_gvl_destroy(rb_global_vm_lock_t *gvl) { gvl_release(gvl); gvl_destroy(gvl); - - if (0) { - rb_vm_t *vm = GET_VM(); - /* may be held by running threads */ - rb_native_mutex_destroy(&vm->waitpid_lock); - rb_native_mutex_destroy(&vm->workqueue_lock); - } } void diff --git a/vm.c b/vm.c index ef1bf0facb..6b8119b1ba 100644 --- a/vm.c +++ b/vm.c @@ -2664,6 +2664,8 @@ ruby_vm_destruct(rb_vm_t *vm) if (objspace) { rb_objspace_free(objspace); } + rb_native_mutex_destroy(&vm->waitpid_lock); + rb_native_mutex_destroy(&vm->workqueue_lock); /* after freeing objspace, you *can't* use ruby_xfree() */ ruby_mimfree(vm); ruby_current_vm_ptr = NULL;