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

ruby-changes:35291

From: akr <ko1@a...>
Date: Wed, 3 Sep 2014 18:56:52 +0900 (JST)
Subject: [ruby-changes:35291] akr:r47373 (trunk): * process.c (forked_child): Removed.

akr	2014-09-03 18:56:38 +0900 (Wed, 03 Sep 2014)

  New Revision: 47373

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

  Log:
    * process.c (forked_child): Removed.

  Modified files:
    trunk/ChangeLog
    trunk/process.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47372)
+++ ChangeLog	(revision 47373)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Sep  3 18:56:05 2014  Tanaka Akira  <akr@f...>
+
+	* process.c (forked_child): Removed.
+
 Wed Sep  3 16:56:07 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* object.c (rb_obj_copy_ivar): allocate no memory for empty
Index: process.c
===================================================================
--- process.c	(revision 47372)
+++ process.c	(revision 47373)
@@ -1094,8 +1094,6 @@ proc_detach(VALUE obj, VALUE pid) https://github.com/ruby/ruby/blob/trunk/process.c#L1094
     return rb_detach_process(NUM2PIDT(pid));
 }
 
-static int forked_child = 0;
-
 #ifdef SIGPIPE
 static RETSIGTYPE (*saved_sigpipe_handler)(int) = 0;
 #endif
@@ -1123,22 +1121,20 @@ before_exec_async_signal_safe(void) https://github.com/ruby/ruby/blob/trunk/process.c#L1121
 }
 
 static void
-before_exec_non_async_signal_safe(void)
+before_exec_non_async_signal_safe()
 {
-    if (!forked_child) {
-	/*
-	 * On Mac OS X 10.5.x (Leopard) or earlier, exec() may return ENOTSUP
-	 * if the process have multiple threads. Therefore we have to kill
-	 * internal threads temporary. [ruby-core:10583]
-	 * This is also true on Haiku. It returns Errno::EPERM against exec()
-	 * in multiple threads.
-	 */
-	rb_thread_stop_timer_thread(0);
-    }
+    /*
+     * On Mac OS X 10.5.x (Leopard) or earlier, exec() may return ENOTSUP
+     * if the process have multiple threads. Therefore we have to kill
+     * internal threads temporary. [ruby-core:10583]
+     * This is also true on Haiku. It returns Errno::EPERM against exec()
+     * in multiple threads.
+     */
+    rb_thread_stop_timer_thread(0);
 }
 
 static void
-before_exec(void)
+before_exec()
 {
     before_exec_non_async_signal_safe();
     before_exec_async_signal_safe();
@@ -1158,8 +1154,6 @@ after_exec_non_async_signal_safe(void) https://github.com/ruby/ruby/blob/trunk/process.c#L1154
 {
     rb_thread_reset_timer_thread();
     rb_thread_start_timer_thread();
-
-    forked_child = 0;
 }
 
 static void
@@ -3087,7 +3081,7 @@ static int https://github.com/ruby/ruby/blob/trunk/process.c#L3081
 rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
 {
     int ret;
-    before_exec_non_async_signal_safe(); /* async-signal-safe if forked_child is true */
+    before_exec_non_async_signal_safe(); /* not async-signal-safe because it calls rb_thread_stop_timer_thread.  */
     ret = rb_exec_async_signal_safe(eargp, errmsg, errmsg_buflen); /* hopefully async-signal-safe */
     preserving_errno(after_exec_non_async_signal_safe()); /* not async-signal-safe because it calls rb_thread_start_timer_thread.  */
     return ret;
@@ -3301,7 +3295,6 @@ retry_fork_async_signal_safe(int *status https://github.com/ruby/ruby/blob/trunk/process.c#L3295
 #endif
         if (pid == 0) {/* fork succeed, child process */
             int ret;
-            forked_child = 1;
             close(ep[0]);
             ret = chfunc(charg, errmsg, errmsg_buflen);
             if (!ret) _exit(EXIT_SUCCESS);
@@ -3312,7 +3305,6 @@ retry_fork_async_signal_safe(int *status https://github.com/ruby/ruby/blob/trunk/process.c#L3305
             _exit(127);
 #endif
         }
-        forked_child = 0; /* for vfork(). */
         if (0 < pid) /* fork succeed, parent process */
             return pid;
         /* fork failed */
@@ -3387,7 +3379,6 @@ rb_fork_ruby(int *status) https://github.com/ruby/ruby/blob/trunk/process.c#L3379
     if (pid < 0)
         return pid;
     if (!pid) {
-        forked_child = 1;
         after_fork();
     }
     return pid;

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

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