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

ruby-changes:40076

From: kosaki <ko1@a...>
Date: Sun, 18 Oct 2015 09:21:10 +0900 (JST)
Subject: [ruby-changes:40076] kosaki:r52157 (trunk): * ruby.c (open_load_file): use rb_thread_wait_fd() instead of reopen.

kosaki	2015-10-18 09:21:03 +0900 (Sun, 18 Oct 2015)

  New Revision: 52157

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

  Log:
    * ruby.c (open_load_file): use rb_thread_wait_fd() instead of reopen.

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52156)
+++ ChangeLog	(revision 52157)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Oct 18 09:20:17 2015  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* ruby.c (open_load_file): use rb_thread_wait_fd() instead of reopen.
+
 Sun Oct 18 05:11:22 2015  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* ruby.c (open_load_file): reset O_NONBLOCK after open.
Index: ruby.c
===================================================================
--- ruby.c	(revision 52156)
+++ ruby.c	(revision 52157)
@@ -1726,19 +1726,6 @@ load_file_internal(VALUE argp_v) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1726
     return (VALUE)tree;
 }
 
-#ifdef S_ISFIFO
-static void *
-loadopen_func(void *arg)
-{
-    int fd;
-    fd = rb_cloexec_open((const char *)arg, O_RDONLY, 0);
-    if (fd >= 0)
-	rb_update_max_fd(fd);
-
-    return (void *)(VALUE)fd;
-}
-#endif
-
 static VALUE
 open_load_file(VALUE fname_v, int *xflag)
 {
@@ -1793,12 +1780,7 @@ open_load_file(VALUE fname_v, int *xflag https://github.com/ruby/ruby/blob/trunk/ruby.c#L1780
 		rb_load_fail(fname_v, strerror(e));
 	    }
 	    if (S_ISFIFO(st.st_mode)) {
-		/* We need to wait if FIFO is empty. So, let's reopen it. */
-		(void)close(fd);
-		fd = (int)(VALUE)rb_thread_call_without_gvl(loadopen_func,
-						(void *)fname, RUBY_UBF_IO, 0);
-		if (fd < 0)
-		    rb_load_fail(fname_v, strerror(errno));
+		rb_thread_wait_fd(fd);
 	    }
 	}
 #endif

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

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