1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

finalizing should be checked before VM lock

This commit is contained in:
Koichi Sasada 2020-12-18 17:59:26 +09:00
parent 7d32bf7853
commit 74ab2c3b46

5
gc.c
View file

@ -3723,11 +3723,12 @@ finalize_deferred(rb_objspace_t *objspace)
static void
gc_finalize_deferred(void *dmy)
{
RB_VM_LOCK_ENTER();
{
rb_objspace_t *objspace = dmy;
if (ATOMIC_EXCHANGE(finalizing, 1)) return;
RB_VM_LOCK_ENTER();
{
finalize_deferred(objspace);
ATOMIC_SET(finalizing, 0);
}