mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Only interrupt when there is no scheduler in sync_wakeup()
* When there is a scheduler, the Fiber that would be blocked has already been rescheduled and there is no point to interrupt something else. That blocked Fiber will be rescheduled as the next call to the scheduler (e.g., IO, sleep, other blocking sync). * See discussion on https://github.com/ruby/ruby/commit/d01954632d
This commit is contained in:
parent
305c430603
commit
5bb5e706f1
1 changed files with 4 additions and 2 deletions
|
@ -34,8 +34,10 @@ sync_wakeup(struct list_head *head, long max)
|
|||
}
|
||||
|
||||
if (cur->th->status != THREAD_KILLED) {
|
||||
rb_threadptr_interrupt(cur->th);
|
||||
cur->th->status = THREAD_RUNNABLE;
|
||||
if (cur->th->scheduler != Qnil) {
|
||||
rb_threadptr_interrupt(cur->th);
|
||||
cur->th->status = THREAD_RUNNABLE;
|
||||
}
|
||||
if (--max == 0) return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue