ruby-changes:64275
From: Koichi <ko1@a...>
Date: Fri, 18 Dec 2020 17:50:21 +0900 (JST)
Subject: [ruby-changes:64275] 61236770e6 (master): need to sync gc_finalize_deferred
https://git.ruby-lang.org/ruby.git/commit/?id=61236770e6 From 61236770e6cc41f1364dc04249d845def03d9f37 Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Fri, 18 Dec 2020 17:49:22 +0900 Subject: need to sync gc_finalize_deferred gc_finalize_deferred() runs finalizers and it accesses objspace, so it need to sync. diff --git a/gc.c b/gc.c index 0c82179..cb7b8af 100644 --- a/gc.c +++ b/gc.c @@ -3725,9 +3725,15 @@ static void https://github.com/ruby/ruby/blob/trunk/gc.c#L3725 gc_finalize_deferred(void *dmy) { rb_objspace_t *objspace = dmy; - if (ATOMIC_EXCHANGE(finalizing, 1)) return; - finalize_deferred(objspace); - ATOMIC_SET(finalizing, 0); + + RB_VM_LOCK_ENTER(); + { + rb_objspace_t *objspace = dmy; + if (ATOMIC_EXCHANGE(finalizing, 1)) return; + finalize_deferred(objspace); + ATOMIC_SET(finalizing, 0); + } + RB_VM_LOCK_LEAVE(); } static void -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/