mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
support require
in non-main Ractors
Many libraries should be loaded on the main ractor because of setting constants with unshareable objects and so on. This patch allows to call `requore` on non-main Ractors by asking the main ractor to call `require` on it. The calling ractor waits for the result of `require` from the main ractor. If the `require` call failed with some reasons, an exception objects will be deliverred from the main ractor to the calling ractor if it is copy-able. Same on `require_relative` and `require` by `autoload`. Now `Ractor.new{pp obj}` works well (the first call of `pp` requires `pp` library implicitly). [Feature #20627]
This commit is contained in:
parent
075a102c93
commit
aa63699d10
Notes:
git
2024-11-08 09:03:09 +00:00
10 changed files with 388 additions and 24 deletions
|
@ -845,7 +845,7 @@ thread_sched_wait_running_turn(struct rb_thread_sched *sched, rb_thread_t *th, b
|
|||
RUBY_DEBUG_LOG("th:%u", rb_th_serial(th));
|
||||
|
||||
ASSERT_thread_sched_locked(sched, th);
|
||||
VM_ASSERT(th == GET_THREAD());
|
||||
VM_ASSERT(th == rb_ec_thread_ptr(rb_current_ec_noinline()));
|
||||
|
||||
if (th != sched->running) {
|
||||
// already deleted from running threads
|
||||
|
@ -900,12 +900,12 @@ thread_sched_wait_running_turn(struct rb_thread_sched *sched, rb_thread_t *th, b
|
|||
thread_sched_set_lock_owner(sched, th);
|
||||
}
|
||||
|
||||
VM_ASSERT(GET_EC() == th->ec);
|
||||
VM_ASSERT(rb_current_ec_noinline() == th->ec);
|
||||
}
|
||||
}
|
||||
|
||||
VM_ASSERT(th->nt != NULL);
|
||||
VM_ASSERT(GET_EC() == th->ec);
|
||||
VM_ASSERT(rb_current_ec_noinline() == th->ec);
|
||||
VM_ASSERT(th->sched.waiting_reason.flags == thread_sched_waiting_none);
|
||||
|
||||
// add th to running threads
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue