mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* thread.c (rb_thread_io_blocking_region): new function to run
blocking region with GIL released, for fd. * thread.c (rb_thread_fd_close): implement. [ruby-core:35203] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
dda8de065c
commit
58b325366d
11 changed files with 94 additions and 13 deletions
|
@ -129,7 +129,7 @@ rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
|
|||
|
||||
while (rb_io_check_closed(fptr),
|
||||
rb_thread_wait_fd(arg.fd),
|
||||
(slen = BLOCKING_REGION(recvfrom_blocking, &arg)) < 0) {
|
||||
(slen = BLOCKING_REGION_FD(recvfrom_blocking, &arg)) < 0) {
|
||||
if (!rb_io_wait_readable(fptr->fd)) {
|
||||
rb_sys_fail("recvfrom(2)");
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ rsock_connect(int fd, const struct sockaddr *sockaddr, int len, int socks)
|
|||
if (socks) func = socks_connect_blocking;
|
||||
#endif
|
||||
for (;;) {
|
||||
status = (int)BLOCKING_REGION(func, &arg);
|
||||
status = (int)BLOCKING_REGION_FD(func, &arg);
|
||||
if (status < 0) {
|
||||
switch (errno) {
|
||||
case EAGAIN:
|
||||
|
@ -515,7 +515,7 @@ rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len)
|
|||
arg.len = len;
|
||||
retry:
|
||||
rb_thread_wait_fd(fd);
|
||||
fd2 = (int)BLOCKING_REGION(accept_blocking, &arg);
|
||||
fd2 = (int)BLOCKING_REGION_FD(accept_blocking, &arg);
|
||||
if (fd2 < 0) {
|
||||
switch (errno) {
|
||||
case EMFILE:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue