diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-02-12 05:44:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-02-12 05:44:23 +0000 |
commit | 58b325366dbc5c84be12fb336ee5e68f208d9365 (patch) | |
tree | e76cc28208f340b4fa1f1a126f35e5953f56e27a /io.c | |
parent | dda8de065c1c7691ec8627d3024a61f324bc9f73 (diff) | |
download | ruby-58b325366dbc5c84be12fb336ee5e68f208d9365.tar.gz |
* 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
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -605,7 +605,7 @@ rb_read_internal(int fd, void *buf, size_t count) iis.buf = buf; iis.capa = count; - return (ssize_t)rb_thread_blocking_region(internal_read_func, &iis, RUBY_UBF_IO, 0); + return (ssize_t)rb_thread_io_blocking_region(internal_read_func, &iis, fd); } static ssize_t @@ -616,7 +616,7 @@ rb_write_internal(int fd, const void *buf, size_t count) iis.buf = buf; iis.capa = count; - return (ssize_t)rb_thread_blocking_region(internal_write_func, &iis, RUBY_UBF_IO, 0); + return (ssize_t)rb_thread_io_blocking_region(internal_write_func, &iis, fd); } static long @@ -653,7 +653,8 @@ io_flush_buffer_sync(void *arg) static VALUE io_flush_buffer_async(VALUE arg) { - return rb_thread_blocking_region(io_flush_buffer_sync, (void *)arg, RUBY_UBF_IO, 0); + rb_io_t *fptr = (rb_io_t *)arg; + return rb_thread_io_blocking_region(io_flush_buffer_sync, fptr, fptr->fd); } static inline int @@ -7475,7 +7476,7 @@ do_io_advise(rb_io_t *fptr, VALUE advice, off_t offset, off_t len) ias.offset = offset; ias.len = len; - if (rv = (int)rb_thread_blocking_region(io_advise_internal, &ias, RUBY_UBF_IO, 0)) + if (rv = (int)rb_thread_io_blocking_region(io_advise_internal, &ias, fptr->fd)) /* posix_fadvise(2) doesn't set errno. On success it returns 0; otherwise it returns the error code. */ rb_syserr_fail(rv, RSTRING_PTR(fptr->pathv)); |