diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-12-21 02:04:38 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-12-21 02:39:34 +0900 |
commit | 6be61ab264c98c96e26b5d3398cf80b49197ba29 (patch) | |
tree | 8e46dc16ea36e0eb1af885ba72d7f24e75b375c6 | |
parent | 435b619a3d5a2d5754a3f739c50f64d1ad520ffc (diff) |
should use owned_p instead of locked_p
It should raise an error if the same thread tris to call
receive/receive_if.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3949
-rw-r--r-- | common.mk | 1 | ||||
-rw-r--r-- | ractor.c | 3 |
2 files changed, 3 insertions, 1 deletions
@@ -10213,6 +10213,7 @@ ractor.$(OBJEXT): $(top_srcdir)/internal/serial.h 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 @@ -12,6 +12,7 @@ #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) 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"); } } |