From a78c02923bd917bf48ea39f1ff174996c46c101e Mon Sep 17 00:00:00 2001 From: yugui Date: Sun, 4 Jan 2009 14:05:19 +0000 Subject: merges r21288 from trunk into ruby_1_9_1. * io.c (maygvl_copy_stream_wait_read): renamed to add prefix to express GVL state. (nogvl_copy_stream_wait_write): ditto. (nogvl_copy_stream_sendfile): ditto. (maygvl_copy_stream_read): ditto. (nogvl_copy_stream_write): ditto. (nogvl_copy_stream_read_write): ditto. (nogvl_copy_stream_func): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 50bc028979..4cc8e749ed 100644 --- a/io.c +++ b/io.c @@ -7296,7 +7296,7 @@ struct copy_stream_struct { }; static int -copy_stream_wait_read(struct copy_stream_struct *stp) +maygvl_copy_stream_wait_read(struct copy_stream_struct *stp) { int ret; rb_fd_zero(&stp->fds); @@ -7311,7 +7311,7 @@ copy_stream_wait_read(struct copy_stream_struct *stp) } static int -copy_stream_wait_write(struct copy_stream_struct *stp) +nogvl_copy_stream_wait_write(struct copy_stream_struct *stp) { int ret; rb_fd_zero(&stp->fds); @@ -7346,7 +7346,7 @@ simple_sendfile(int out_fd, int in_fd, off_t *offset, size_t count) #ifdef USE_SENDFILE static int -copy_stream_sendfile(struct copy_stream_struct *stp) +nogvl_copy_stream_sendfile(struct copy_stream_struct *stp) { struct stat src_stat, dst_stat; ssize_t ss; @@ -7418,7 +7418,7 @@ copy_stream_sendfile(struct copy_stream_struct *stp) #if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN case EWOULDBLOCK: #endif - if (copy_stream_wait_write(stp) == -1) + if (nogvl_copy_stream_wait_write(stp) == -1) return -1; if (rb_thread_interrupted(stp->th)) return -1; @@ -7433,7 +7433,7 @@ copy_stream_sendfile(struct copy_stream_struct *stp) #endif static ssize_t -copy_stream_read(struct copy_stream_struct *stp, char *buf, int len, off_t offset) +maygvl_copy_stream_read(struct copy_stream_struct *stp, char *buf, int len, off_t offset) { ssize_t ss; retry_read: @@ -7456,7 +7456,7 @@ copy_stream_read(struct copy_stream_struct *stp, char *buf, int len, off_t offse #if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN case EWOULDBLOCK: #endif - if (copy_stream_wait_read(stp) == -1) + if (maygvl_copy_stream_wait_read(stp) == -1) return -1; goto retry_read; #ifdef ENOSYS @@ -7473,7 +7473,7 @@ copy_stream_read(struct copy_stream_struct *stp, char *buf, int len, off_t offse } static int -copy_stream_write(struct copy_stream_struct *stp, char *buf, int len) +nogvl_copy_stream_write(struct copy_stream_struct *stp, char *buf, int len) { ssize_t ss; int off = 0; @@ -7481,7 +7481,7 @@ copy_stream_write(struct copy_stream_struct *stp, char *buf, int len) ss = write(stp->dst_fd, buf+off, len); if (ss == -1) { if (errno == EAGAIN || errno == EWOULDBLOCK) { - if (copy_stream_wait_write(stp) == -1) + if (nogvl_copy_stream_wait_write(stp) == -1) return -1; continue; } @@ -7497,7 +7497,7 @@ copy_stream_write(struct copy_stream_struct *stp, char *buf, int len) } static void -copy_stream_read_write(struct copy_stream_struct *stp) +nogvl_copy_stream_read_write(struct copy_stream_struct *stp) { char buf[1024*16]; int len; @@ -7533,17 +7533,17 @@ copy_stream_read_write(struct copy_stream_struct *stp) len = sizeof(buf); } if (use_pread) { - ss = copy_stream_read(stp, buf, len, src_offset); + ss = maygvl_copy_stream_read(stp, buf, len, src_offset); if (0 < ss) src_offset += ss; } else { - ss = copy_stream_read(stp, buf, len, (off_t)-1); + ss = maygvl_copy_stream_read(stp, buf, len, (off_t)-1); } if (ss <= 0) /* EOF or error */ return; - ret = copy_stream_write(stp, buf, ss); + ret = nogvl_copy_stream_write(stp, buf, ss); if (ret < 0) return; @@ -7556,7 +7556,7 @@ copy_stream_read_write(struct copy_stream_struct *stp) } static VALUE -copy_stream_func(void *arg) +nogvl_copy_stream_func(void *arg) { struct copy_stream_struct *stp = (struct copy_stream_struct *)arg; #ifdef USE_SENDFILE @@ -7564,12 +7564,12 @@ copy_stream_func(void *arg) #endif #ifdef USE_SENDFILE - ret = copy_stream_sendfile(stp); + ret = nogvl_copy_stream_sendfile(stp); if (ret != 0) goto finish; /* error or success */ #endif - copy_stream_read_write(stp); + nogvl_copy_stream_read_write(stp); #ifdef USE_SENDFILE finish: @@ -7612,7 +7612,7 @@ copy_stream_fallback_body(VALUE arg) ssize_t ss; rb_thread_wait_fd(stp->src_fd); rb_str_resize(buf, buflen); - ss = copy_stream_read(stp, RSTRING_PTR(buf), l, off); + ss = maygvl_copy_stream_read(stp, RSTRING_PTR(buf), l, off); if (ss == -1) return Qnil; if (ss == 0) @@ -7751,7 +7751,7 @@ copy_stream_body(VALUE arg) rb_fd_set(src_fd, &stp->fds); rb_fd_set(dst_fd, &stp->fds); - return rb_thread_blocking_region(copy_stream_func, (void*)stp, RUBY_UBF_IO, 0); + return rb_thread_blocking_region(nogvl_copy_stream_func, (void*)stp, RUBY_UBF_IO, 0); } static VALUE -- cgit v1.2.3