summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-06 20:19:29 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-06 20:19:29 +0000
commitea0ef6af8388ecdfdaa166242b5e3d82d906eb11 (patch)
tree7d7472e88bc3522c91f0da9276efcbbbe71454d6
parent4b295bb7ca2f4ea4aaee2eaf730fb55aae4f716e (diff)
merge revision(s) r33826:
* io.c (rb_io_fsync,rb_io_fdatasync): release GVL during fsync(). fsync() and fdatasync() may take a long time on slow disks and/or if there is much dirty data. Patch by Eric Wong. [Feature #5665] [ruby-core:41247] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--io.c18
-rw-r--r--version.h2
3 files changed, 24 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ac8947bf5d..243caf3274 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Feb 6 15:19:17 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_fsync,rb_io_fdatasync): release GVL during fsync().
+ fsync() and fdatasync() may take a long time on slow disks and/or
+ if there is much dirty data.
+ Patch by Eric Wong. [Feature #5665] [ruby-core:41247]
+
Mon Feb 6 15:01:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_eval.c (vm_call0): should pass block to enumerators. patched
diff --git a/io.c b/io.c
index a6f323e816..9846596aba 100644
--- a/io.c
+++ b/io.c
@@ -1358,6 +1358,13 @@ rb_io_set_sync(VALUE io, VALUE sync)
}
#ifdef HAVE_FSYNC
+static VALUE nogvl_fsync(void *ptr)
+{
+ rb_io_t *fptr = ptr;
+
+ return (VALUE)fsync(fptr->fd);
+}
+
/*
* call-seq:
* ios.fsync -> 0 or nil
@@ -1383,7 +1390,7 @@ rb_io_fsync(VALUE io)
if (io_fflush(fptr) < 0)
rb_sys_fail(0);
#ifndef _WIN32 /* already called in io_fflush() */
- if (fsync(fptr->fd) < 0)
+ if ((int)rb_thread_io_blocking_region(nogvl_fsync, fptr, fptr->fd) < 0)
rb_sys_fail_path(fptr->pathv);
#endif
return INT2FIX(0);
@@ -1393,6 +1400,13 @@ rb_io_fsync(VALUE io)
#endif
#ifdef HAVE_FDATASYNC
+static VALUE nogvl_fdatasync(void *ptr)
+{
+ rb_io_t *fptr = ptr;
+
+ return (VALUE)fdatasync(fptr->fd);
+}
+
/*
* call-seq:
* ios.fdatasync -> 0 or nil
@@ -1415,7 +1429,7 @@ rb_io_fdatasync(VALUE io)
if (io_fflush(fptr) < 0)
rb_sys_fail(0);
- if (fdatasync(fptr->fd) == 0)
+ if ((int)rb_thread_io_blocking_region(nogvl_fdatasync, fptr, fptr->fd) == 0)
return INT2FIX(0);
/* fall back */
diff --git a/version.h b/version.h
index 1d96d4b718..d343ef4d36 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 44
+#define RUBY_PATCHLEVEL 45
#define RUBY_RELEASE_DATE "2012-02-07"
#define RUBY_RELEASE_YEAR 2012