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) { while (target_th->status != THREAD_KILLED) {
if (th->scheduler != Qnil) { VALUE scheduler = rb_thread_current_scheduler();
rb_scheduler_block(th->scheduler, target_th->self, p->timeout);
if (scheduler != Qnil) {
rb_scheduler_block(scheduler, target_th->self, p->timeout);
} else if (!limit) { } else if (!limit) {
th->status = THREAD_STOPPED_FOREVER; th->status = THREAD_STOPPED_FOREVER;
rb_ractor_sleeper_threads_inc(th->ractor); rb_ractor_sleeper_threads_inc(th->ractor);