summaryrefslogtreecommitdiff
path: root/ractor.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-12-21 18:06:28 +0900
committerKoichi Sasada <ko1@atdot.net>2020-12-21 22:29:05 +0900
commitdca6752fecc6733575145185764d7b6a218cee96 (patch)
tree1628aa1a7d65fba03e6c662c471fdbd06efa0203 /ractor.c
parent8c0c61728fd08bd7c3c29612de8b3486d75339dc (diff)
Introduce Ractor::IsolationError
Ractor has several restrictions to keep each ractor being isolated and some operation such as `CONST="foo"` in non-main ractor raises an exception. This kind of operation raises an error but there is confusion (some code raises RuntimeError and some code raises NameError). To make clear we introduce Ractor::IsolationError which is raised when the isolation between ractors is violated.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3957
Diffstat (limited to 'ractor.c')
-rw-r--r--ractor.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/ractor.c b/ractor.c
index 8c4f06a6b0..b8564199d5 100644
--- a/ractor.c
+++ b/ractor.c
@@ -18,18 +18,14 @@
#include "transient_heap.h"
VALUE rb_cRactor;
+
+VALUE rb_eRactorUnsafeError;
+VALUE rb_eRactorIsolationError;
static VALUE rb_eRactorError;
static VALUE rb_eRactorRemoteError;
static VALUE rb_eRactorMovedError;
static VALUE rb_eRactorClosedError;
static VALUE rb_cRactorMovedObject;
-VALUE rb_eRactorUnsafeError;
-
-VALUE
-rb_ractor_error_class(void)
-{
- return rb_eRactorError;
-}
static void vm_ractor_blocking_cnt_inc(rb_vm_t *vm, rb_ractor_t *r, const char *file, int line);
@@ -2023,11 +2019,12 @@ void
Init_Ractor(void)
{
rb_cRactor = rb_define_class("Ractor", rb_cObject);
- rb_eRactorError = rb_define_class_under(rb_cRactor, "Error", rb_eRuntimeError);
- rb_eRactorRemoteError = rb_define_class_under(rb_cRactor, "RemoteError", rb_eRactorError);
- rb_eRactorMovedError = rb_define_class_under(rb_cRactor, "MovedError", rb_eRactorError);
- rb_eRactorClosedError = rb_define_class_under(rb_cRactor, "ClosedError", rb_eStopIteration);
- rb_eRactorUnsafeError = rb_define_class_under(rb_cRactor, "UnsafeError", rb_eRactorError);
+ rb_eRactorError = rb_define_class_under(rb_cRactor, "Error", rb_eRuntimeError);
+ rb_eRactorIsolationError = rb_define_class_under(rb_cRactor, "IsolationError", rb_eRactorError);
+ rb_eRactorRemoteError = rb_define_class_under(rb_cRactor, "RemoteError", rb_eRactorError);
+ rb_eRactorMovedError = rb_define_class_under(rb_cRactor, "MovedError", rb_eRactorError);
+ rb_eRactorClosedError = rb_define_class_under(rb_cRactor, "ClosedError", rb_eStopIteration);
+ rb_eRactorUnsafeError = rb_define_class_under(rb_cRactor, "UnsafeError", rb_eRactorError);
rb_cRactorMovedObject = rb_define_class_under(rb_cRactor, "MovedObject", rb_cBasicObject);
rb_undef_alloc_func(rb_cRactorMovedObject);