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

ruby-changes:15559

From: mame <ko1@a...>
Date: Sat, 24 Apr 2010 00:44:36 +0900 (JST)
Subject: [ruby-changes:15559] Ruby:r27464 (trunk): * process.c (rb_f_fork): remove after_exec() which sometimes caused

mame	2010-04-24 00:44:19 +0900 (Sat, 24 Apr 2010)

  New Revision: 27464

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

  Log:
    * process.c (rb_f_fork): remove after_exec() which sometimes caused
      two timer threads started.  [ruby-core:25217]
    
    * signal.c: use pthread_sigmask() instead of sigprocmask().
      sigprocmask() is unspecified behavior on multi-thread programs.
      [ruby-core:25217]

  Modified files:
    trunk/ChangeLog
    trunk/process.c
    trunk/signal.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27463)
+++ ChangeLog	(revision 27464)
@@ -1,3 +1,12 @@
+Sat Apr 24 00:41:52 2010  Yusuke Endoh  <mame@t...>
+
+	* process.c (rb_f_fork): remove after_exec() which sometimes caused
+	  two timer threads started.  [ruby-core:25217]
+
+	* signal.c: use pthread_sigmask() instead of sigprocmask().
+	  sigprocmask() is unspecified behavior on multi-thread programs.
+	  [ruby-core:25217]
+
 Sat Apr 24 00:36:05 2010  Yusuke Endoh  <mame@t...>
 
 	* test/dl/test_base.rb: add kfreebsd support.  based on a patch from
Index: process.c
===================================================================
--- process.c	(revision 27463)
+++ process.c	(revision 27464)
@@ -2620,9 +2620,6 @@
 
     switch (pid = rb_fork(0, 0, 0, Qnil)) {
       case 0:
-#ifdef linux
-	after_exec();
-#endif
 	rb_thread_atfork();
 	if (rb_block_given_p()) {
 	    int status;
Index: signal.c
===================================================================
--- signal.c	(revision 27463)
+++ signal.c	(revision 27464)
@@ -888,11 +888,7 @@
 trap_ensure(struct trap_arg *arg)
 {
     /* enable interrupt */
-#ifdef HAVE_SIGPROCMASK
-    sigprocmask(SIG_SETMASK, &arg->mask, NULL);
-#else
-    sigsetmask(arg->mask);
-#endif
+    pthread_sigmask(SIG_SETMASK, &arg->mask, NULL);
     trap_last_mask = arg->mask;
     return 0;
 }
@@ -902,11 +898,7 @@
 rb_trap_restore_mask(void)
 {
 #if USE_TRAP_MASK
-# ifdef HAVE_SIGPROCMASK
-    sigprocmask(SIG_SETMASK, &trap_last_mask, NULL);
-# else
-    sigsetmask(trap_last_mask);
-# endif
+    pthread_sigmask(SIG_SETMASK, &trap_last_mask, NULL);
 #endif
 }
 
@@ -966,12 +958,8 @@
     }
 #if USE_TRAP_MASK
     /* disable interrupt */
-# ifdef HAVE_SIGPROCMASK
     sigfillset(&arg.mask);
-    sigprocmask(SIG_BLOCK, &arg.mask, &arg.mask);
-# else
-    arg.mask = sigblock(~0);
-# endif
+    pthread_sigmask(SIG_BLOCK, &arg.mask, &arg.mask);
 
     return rb_ensure(trap, (VALUE)&arg, trap_ensure, (VALUE)&arg);
 #else
@@ -1026,12 +1014,8 @@
 
 #if USE_TRAP_MASK
     /* disable interrupt */
-# ifdef HAVE_SIGPROCMASK
     sigfillset(&mask);
-    sigprocmask(SIG_BLOCK, &mask, &mask);
-# else
-    mask = sigblock(~0);
-# endif
+    pthread_sigmask(SIG_BLOCK, &mask, &mask);
 #endif
 
     oldfunc = ruby_signal(sig, SIG_DFL);
@@ -1042,13 +1026,8 @@
     }
 
 #if USE_TRAP_MASK
-#ifdef HAVE_SIGPROCMASK
     sigdelset(&mask, sig);
-    sigprocmask(SIG_SETMASK, &mask, NULL);
-#else
-    mask &= ~sigmask(sig);
-    sigsetmask(mask);
-#endif
+    pthread_sigmask(SIG_SETMASK, &mask, NULL);
     trap_last_mask = mask;
 #endif
 }

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

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