[前][次][番号順一覧][スレッド一覧]

ruby-changes:65427

From: Nobuyoshi <ko1@a...>
Date: Tue, 9 Mar 2021 20:11:56 +0900 (JST)
Subject: [ruby-changes:65427] 2a83650b0f (master): Destroy VM-wise locks before freeing [Bug #15852]

https://git.ruby-lang.org/ruby.git/commit/?id=2a83650b0f

From 2a83650b0fd25719fb6c03bfec7bd895734d3ceb Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 19 Feb 2021 11:40:37 +0900
Subject: Destroy VM-wise locks before freeing [Bug #15852]

---
 thread.c | 7 -------
 vm.c     | 2 ++
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/thread.c b/thread.c
index f2dd417..2f5e279 100644
--- a/thread.c
+++ b/thread.c
@@ -424,13 +424,6 @@ rb_vm_gvl_destroy(rb_global_vm_lock_t *gvl) https://github.com/ruby/ruby/blob/trunk/thread.c#L424
 {
     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 ef1bf0f..6b8119b 100644
--- a/vm.c
+++ b/vm.c
@@ -2664,6 +2664,8 @@ ruby_vm_destruct(rb_vm_t *vm) https://github.com/ruby/ruby/blob/trunk/vm.c#L2664
 	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;
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]