summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-28 02:47:51 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-28 02:47:51 +0000
commit02f9b4d60611016f06e3eae774c1ad9140780217 (patch)
tree6e702237a7a81d84673a476d4bc7e7654619383b
parentd81c20771d440001295945086d0c58e4125b5660 (diff)
* io.c (rb_io_flush): release GVL during fsync() on Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--io.c21
2 files changed, 16 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index c0c53cd173..098bb242bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Nov 28 11:46:35 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (rb_io_flush): release GVL during fsync() on Windows.
+
Mon Nov 28 11:00:25 2011 NAKAMURA Usaku <usa@ruby-lang.org>
* include/ruby/subst.h: typo of r33876.
diff --git a/io.c b/io.c
index 3a0ba43097..4b5896a596 100644
--- a/io.c
+++ b/io.c
@@ -1187,6 +1187,15 @@ rb_io_addstr(VALUE io, VALUE str)
return io;
}
+#ifdef HAVE_FSYNC
+static VALUE nogvl_fsync(void *ptr)
+{
+ rb_io_t *fptr = ptr;
+
+ return (VALUE)fsync(fptr->fd);
+}
+#endif
+
/*
* call-seq:
* ios.flush -> ios
@@ -1220,7 +1229,7 @@ rb_io_flush(VALUE io)
rb_sys_fail(0);
#ifdef _WIN32
if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) == FILE_TYPE_DISK) {
- fsync(fptr->fd);
+ rb_thread_io_blocking_region(nogvl_fsync, fptr, fptr->fd);
}
#endif
}
@@ -1332,6 +1341,8 @@ rb_io_set_pos(VALUE io, VALUE offset)
static void clear_readconv(rb_io_t *fptr);
+#ifdef HAVE_FSYNC
+
/*
* call-seq:
* ios.rewind -> 0
@@ -1508,14 +1519,6 @@ rb_io_set_sync(VALUE io, VALUE sync)
return 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