diff options
Diffstat (limited to 'thread.c')
| -rw-r--r-- | thread.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1698,7 +1698,12 @@ thread_io_wake_pending_closer(struct waiting_fd *wfd) RB_VM_LOCK_LEAVE(); if (has_waiter) { - rb_thread_wakeup(wfd->busy->closing_thread); + rb_thread_t *th = rb_thread_ptr(wfd->busy->closing_thread); + if (th->scheduler != Qnil) { + rb_fiber_scheduler_unblock(th->scheduler, wfd->busy->closing_thread, wfd->busy->closing_fiber); + } else { + rb_thread_wakeup(wfd->busy->closing_thread); + } rb_mutex_unlock(wfd->busy->wakeup_mutex); } } @@ -2609,6 +2614,7 @@ rb_notify_fd_close(int fd, struct rb_io_close_wait_list *busy) has_any = !ccan_list_empty(&busy->pending_fd_users); busy->closing_thread = rb_thread_current(); + busy->closing_fiber = rb_fiber_current(); wakeup_mutex = Qnil; if (has_any) { wakeup_mutex = rb_mutex_new(); |
