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

ruby-changes:24890

From: kosaki <ko1@a...>
Date: Mon, 10 Sep 2012 02:12:38 +0900 (JST)
Subject: [ruby-changes:24890] kosaki:r36942 (trunk): * io.c (rb_io_close): notify fd close before releasing gvl.

kosaki	2012-09-10 02:11:03 +0900 (Mon, 10 Sep 2012)

  New Revision: 36942

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

  Log:
    * io.c (rb_io_close): notify fd close before releasing gvl.
    * io.c (fptr_finalize): modify fptr->mode before releasing gvl.
      remove unnecessary rb_thread_fd_close().
      [Feature #4570] [ruby-core:35711]

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36941)
+++ ChangeLog	(revision 36942)
@@ -1,3 +1,10 @@
+Mon Sep 10 01:36:00 2012  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* io.c (rb_io_close): notify fd close before releasing gvl.
+	* io.c (fptr_finalize): modify fptr->mode before releasing gvl.
+	  remove unnecessary rb_thread_fd_close().
+	  [Feature #4570] [ruby-core:35711]
+
 Mon Sep 10 00:16:34 2012  NARUSE, Yui  <naruse@r...>
 
 	* process.c: exec() requires to be single threaded also on Haiku.
Index: io.c
===================================================================
--- io.c	(revision 36941)
+++ io.c	(revision 36942)
@@ -3922,8 +3922,8 @@
 
     fptr->fd = -1;
     fptr->stdio_file = 0;
-    if (!noraise)
-	rb_thread_fd_close(fd);
+    fptr->mode &= ~(FMODE_READABLE|FMODE_WRITABLE);
+
     if (IS_PREP_STDIO(fptr) || fd <= 2) {
 	/* need to keep FILE objects of stdin, stdout and stderr */
     }
@@ -3940,7 +3940,6 @@
 	if ((maygvl_close(fd, noraise) < 0) && NIL_P(err))
 	    err = noraise ? Qtrue : INT2NUM(errno);
     }
-    fptr->mode &= ~(FMODE_READABLE|FMODE_WRITABLE);
 
     if (!NIL_P(err) && !noraise) {
         switch(TYPE(err)) {
@@ -4052,13 +4051,8 @@
     if (fptr->fd < 0) return Qnil;
 
     fd = fptr->fd;
-#if defined __APPLE__ && (!defined(MAC_OS_X_VERSION_MIN_ALLOWED) || MAC_OS_X_VERSION_MIN_ALLOWED <= 1050)
-    /* close(2) on a fd which is being read by another thread causes
-     * deadlock on Mac OS X 10.5 */
     rb_thread_fd_close(fd);
-#endif
     rb_io_fptr_cleanup(fptr, FALSE);
-    rb_thread_fd_close(fd);
 
     if (fptr->pid) {
         rb_last_status_clear();

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

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