[前][次][番号順一覧][スレッド一覧]

ruby-changes:21829

From: usa <ko1@a...>
Date: Mon, 28 Nov 2011 11:48:57 +0900 (JST)
Subject: [ruby-changes:21829] usa:r33878 (trunk): * io.c (rb_io_flush): release GVL during fsync() on Windows.

usa	2011-11-28 11:47:51 +0900 (Mon, 28 Nov 2011)

  New Revision: 33878

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33878

  Log:
    * io.c (rb_io_flush): release GVL during fsync() on Windows.

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33877)
+++ ChangeLog	(revision 33878)
@@ -1,3 +1,7 @@
+Mon Nov 28 11:46:35 2011  NAKAMURA Usaku  <usa@r...>
+
+	* io.c (rb_io_flush): release GVL during fsync() on Windows.
+
 Mon Nov 28 11:00:25 2011  NAKAMURA Usaku  <usa@r...>
 
 	* include/ruby/subst.h: typo of r33876.
Index: io.c
===================================================================
--- io.c	(revision 33877)
+++ io.c	(revision 33878)
@@ -1187,6 +1187,15 @@
     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_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 @@
 
 static void clear_readconv(rb_io_t *fptr);
 
+#ifdef HAVE_FSYNC
+
 /*
  *  call-seq:
  *     ios.rewind    -> 0
@@ -1508,14 +1519,6 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]