зеркало из https://github.com/github/ruby.git
ractor.c: Add a helper function to ensure the context is a main ractor
This commit is contained in:
Родитель
a94002115b
Коммит
23530d68cb
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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче