1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Don't use th->scheduler directly because it's not always valid to do so.

This commit is contained in:
Samuel Williams 2020-10-01 20:22:55 +13:00
parent 1d3024da26
commit 2db081b5ff
Notes: git 2020-10-01 17:39:06 +09:00

View file

@ -1175,8 +1175,10 @@ thread_join_sleep(VALUE arg)
}
while (target_th->status != THREAD_KILLED) {
if (th->scheduler != Qnil) {
rb_scheduler_block(th->scheduler, target_th->self, p->timeout);
VALUE scheduler = rb_thread_current_scheduler();
if (scheduler != Qnil) {
rb_scheduler_block(scheduler, target_th->self, p->timeout);
} else if (!limit) {
th->status = THREAD_STOPPED_FOREVER;
rb_ractor_sleeper_threads_inc(th->ractor);