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

ruby-changes:8870

From: yugui <ko1@a...>
Date: Sun, 30 Nov 2008 18:24:02 +0900 (JST)
Subject: [ruby-changes:8870] Ruby:r20406 (ruby_1_9_1): merges r20346 from trunk into ruby_1_9_1.

yugui	2008-11-30 18:22:21 +0900 (Sun, 30 Nov 2008)

  New Revision: 20406

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

  Log:
    merges r20346 from trunk into ruby_1_9_1.
    * process.c (rb_fork): stops the timer thread during fork.
      [ruby-dev:37117]
    * thread.c (rb_thread_start_timer_thread): timer thread needs
      system_working to be set.

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/process.c
    branches/ruby_1_9_1/thread.c

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 20405)
+++ ruby_1_9_1/ChangeLog	(revision 20406)
@@ -1,3 +1,11 @@
+Tue Nov 25 00:08:22 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* process.c (rb_fork): stops the timer thread during fork.
+	  [ruby-dev:37117]
+
+	* thread.c (rb_thread_start_timer_thread): timer thread needs
+	  system_working to be set.
+
 Mon Nov 24 23:27:28 2008  Shugo Maeda  <shugo@r...>
 
 	* strftime.c (rb_strftime): The # flag should work with %a, %A, %b,
Index: ruby_1_9_1/thread.c
===================================================================
--- ruby_1_9_1/thread.c	(revision 20405)
+++ ruby_1_9_1/thread.c	(revision 20406)
@@ -2371,6 +2371,7 @@
 void
 rb_thread_start_timer_thread(void)
 {
+    system_working = 1;
     rb_thread_create_timer_thread();
 }
 
Index: ruby_1_9_1/process.c
===================================================================
--- ruby_1_9_1/process.c	(revision 20405)
+++ ruby_1_9_1/process.c	(revision 20406)
@@ -975,6 +975,8 @@
   (rb_enable_interrupt(), rb_thread_stop_timer_thread())
 #define after_exec() \
   (rb_thread_start_timer_thread(), rb_disable_interrupt())
+#define before_fork() before_exec()
+#define after_fork() after_exec()
 
 #include "dln.h"
 
@@ -2272,7 +2274,8 @@
 	}
     }
 #endif
-    for (; (pid = fork()) < 0; prefork()) {
+    for (; before_fork(), (pid = fork()) < 0; prefork()) {
+	after_fork();
 	switch (errno) {
 	  case EAGAIN:
 #if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
@@ -2298,7 +2301,6 @@
 	}
     }
     if (!pid) {
-	rb_thread_reset_timer_thread();
 	if (chfunc) {
 #ifdef FD_CLOEXEC
 	    close(ep[0]);
@@ -2314,10 +2316,10 @@
 	    _exit(127);
 #endif
 	}
-	rb_thread_start_timer_thread();
     }
+    after_fork();
 #ifdef FD_CLOEXEC
-    else if (chfunc) {
+    if (pid && chfunc) {
 	close(ep[1]);
 	if ((state = read(ep[0], &err, sizeof(err))) < 0) {
 	    err = errno;

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

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