mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ractor.c: Add a helper function to ensure the context is a main ractor
This commit is contained in:
parent
a94002115b
commit
23530d68cb
Notes:
git
2022-03-30 16:51:11 +09:00
2 changed files with 10 additions and 0 deletions
8
ractor.c
8
ractor.c
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -185,6 +185,8 @@ void rb_ractor_atfork(rb_vm_t *vm, rb_thread_t *th);
|
|||
|
||||
VALUE rb_ractor_ensure_shareable(VALUE obj, VALUE name);
|
||||
|
||||
void rb_ractor_ensure_main_ractor(const char *msg);
|
||||
|
||||
RUBY_SYMBOL_EXPORT_BEGIN
|
||||
bool rb_ractor_shareable_p_continue(VALUE obj);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue