ruby-changes:64393
From: Koichi <ko1@a...>
Date: Mon, 21 Dec 2020 02:39:47 +0900 (JST)
Subject: [ruby-changes:64393] 6be61ab264 (master): should use owned_p instead of locked_p
https://git.ruby-lang.org/ruby.git/commit/?id=6be61ab264 From 6be61ab264c98c96e26b5d3398cf80b49197ba29 Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Mon, 21 Dec 2020 02:04:38 +0900 Subject: should use owned_p instead of locked_p It should raise an error if the same thread tris to call receive/receive_if. diff --git a/common.mk b/common.mk index 607ad86..2cfa952 100644 --- a/common.mk +++ b/common.mk @@ -10213,6 +10213,7 @@ ractor.$(OBJEXT): $(top_srcdir)/internal/serial.h https://github.com/ruby/ruby/blob/trunk/common.mk#L10213 ractor.$(OBJEXT): $(top_srcdir)/internal/static_assert.h ractor.$(OBJEXT): $(top_srcdir)/internal/string.h ractor.$(OBJEXT): $(top_srcdir)/internal/struct.h +ractor.$(OBJEXT): $(top_srcdir)/internal/thread.h ractor.$(OBJEXT): $(top_srcdir)/internal/vm.h ractor.$(OBJEXT): $(top_srcdir)/internal/warnings.h ractor.$(OBJEXT): {$(VPATH)}assert.h diff --git a/ractor.c b/ractor.c index be067d6..7c5c864 100644 --- a/ractor.c +++ b/ractor.c @@ -12,6 +12,7 @@ https://github.com/ruby/ruby/blob/trunk/ractor.c#L12 #include "internal/hash.h" #include "internal/rational.h" #include "internal/struct.h" +#include "internal/thread.h" #include "variable.h" #include "gc.h" #include "transient_heap.h" @@ -473,7 +474,7 @@ ractor_basket_accept(struct rb_ractor_basket *b) https://github.com/ruby/ruby/blob/trunk/ractor.c#L474 static void ractor_recursive_receive_if(rb_ractor_t *r) { - if (r->receiving_mutex && rb_mutex_locked_p(r->receiving_mutex)) { + if (r->receiving_mutex && rb_mutex_owned_p(r->receiving_mutex)) { rb_raise(rb_eRactorError, "can not call receive/receive_if recursively"); } } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/