summaryrefslogtreecommitdiff
path: root/ractor.c
diff options
context:
space:
mode:
Diffstat (limited to 'ractor.c')
-rw-r--r--ractor.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ractor.c b/ractor.c
index 7675a09832..484b5c78b9 100644
--- a/ractor.c
+++ b/ractor.c
@@ -2442,6 +2442,17 @@ rb_ractor_make_shareable_copy(VALUE obj)
return copy;
}
+VALUE
+rb_ractor_ensure_shareable(VALUE obj, VALUE name)
+{
+ if (!RTEST(rb_ractor_shareable_p(obj))) {
+ VALUE message = rb_sprintf("cannot assign unshareable object to %"PRIsVALUE,
+ name);
+ rb_exc_raise(rb_exc_new_str(rb_eRactorError, message));
+ }
+ return obj;
+}
+
static enum obj_traverse_iterator_result
shareable_p_enter(VALUE obj)
{