Skip to content

Commit

Permalink
MN: skip waiting on `read_nonblock'
Browse files Browse the repository at this point in the history
if the IO for `IO#read_nonblock` is not ready, it needs
to return (or raise) immediately.
  • Loading branch information
ko1 committed Dec 22, 2023
1 parent 2fe9e08 commit beec3d0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion io.c
Expand Up @@ -3410,7 +3410,12 @@ io_read_memory_call(VALUE arg)
}
}

return rb_thread_io_blocking_call(internal_read_func, iis, iis->fptr->fd, RB_WAITFD_IN);
if (iis->nonblock) {
return rb_thread_io_blocking_call(internal_read_func, iis, iis->fptr->fd, 0);
}
else {
return rb_thread_io_blocking_call(internal_read_func, iis, iis->fptr->fd, RB_WAITFD_IN);
}
}

static long
Expand Down

0 comments on commit beec3d0

Please sign in to comment.