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

ruby-changes:63856

From: Takashi <ko1@a...>
Date: Thu, 3 Dec 2020 16:39:47 +0900 (JST)
Subject: [ruby-changes:63856] 58c3c75fee (master): Skip checking Ractor recursive locking

https://git.ruby-lang.org/ruby.git/commit/?id=58c3c75fee

From 58c3c75fee775abb9a145e7b106320a55f2c8be1 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Wed, 2 Dec 2020 23:38:40 -0800
Subject: Skip checking Ractor recursive locking

for an MJIT worker thread. We can't do it because its GET_EC() returns
NULL.

diff --git a/ractor.c b/ractor.c
index fcdf5cf..f17a75b 100644
--- a/ractor.c
+++ b/ractor.c
@@ -40,7 +40,8 @@ static void https://github.com/ruby/ruby/blob/trunk/ractor.c#L40
 ASSERT_ractor_unlocking(rb_ractor_t *r)
 {
 #if RACTOR_CHECK_MODE > 0
-    if (r->locked_by == GET_RACTOR()->self) {
+    // GET_EC is NULL in an MJIT worker
+    if (GET_EC() != NULL && r->locked_by == GET_RACTOR()->self) {
         rb_bug("recursive ractor locking");
     }
 #endif
@@ -50,7 +51,8 @@ static void https://github.com/ruby/ruby/blob/trunk/ractor.c#L51
 ASSERT_ractor_locking(rb_ractor_t *r)
 {
 #if RACTOR_CHECK_MODE > 0
-    if (r->locked_by != GET_RACTOR()->self) {
+    // GET_EC is NULL in an MJIT worker
+    if (GET_EC() != NULL && r->locked_by != GET_RACTOR()->self) {
         rp(r->locked_by);
         rb_bug("ractor lock is not acquired.");
     }
@@ -66,7 +68,9 @@ ractor_lock(rb_ractor_t *r, const char *file, int line) https://github.com/ruby/ruby/blob/trunk/ractor.c#L68
     rb_native_mutex_lock(&r->lock);
 
 #if RACTOR_CHECK_MODE > 0
-    r->locked_by = GET_RACTOR()->self;
+    if (GET_EC() != NULL) { // GET_EC is NULL in an MJIT worker
+        r->locked_by = GET_RACTOR()->self;
+    }
 #endif
 
     RUBY_DEBUG_LOG2(file, line, "locked  r:%u%s", r->id, GET_RACTOR() == r ? " (self)" : "");
-- 
cgit v0.10.2


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

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