diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2022-03-24 14:14:07 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2022-03-30 16:50:46 +0900 |
commit | 23530d68cb04aed9c2f59a050523b0193ee2d0c1 (patch) | |
tree | d56d750e74bed919b4099f880e06f759eb451015 /ractor.c | |
parent | a94002115beaf989aec4c9b2a746ac8d19440e57 (diff) |
ractor.c: Add a helper function to ensure the context is a main ractor
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5703
Diffstat (limited to 'ractor.c')
-rw-r--r-- | ractor.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -2531,6 +2531,14 @@ rb_ractor_ensure_shareable(VALUE obj, VALUE name) return obj; } +void +rb_ractor_ensure_main_ractor(const char *msg) +{ + if (!rb_ractor_main_p()) { + rb_raise(rb_eRactorIsolationError, "%s", msg); + } +} + static enum obj_traverse_iterator_result shareable_p_enter(VALUE obj) { |