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

ruby-changes:20269

From: ko1 <ko1@a...>
Date: Thu, 30 Jun 2011 12:34:34 +0900 (JST)
Subject: [ruby-changes:20269] ko1:r32319 (trunk): * thread_pthread.c (rb_thread_create_timer_thread): allocate

ko1	2011-06-30 12:34:16 +0900 (Thu, 30 Jun 2011)

  New Revision: 32319

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

  Log:
    * thread_pthread.c (rb_thread_create_timer_thread): allocate
      machine stack for the timer thread at least 12KB.  FreeBSD 8.2
      AMD64 causes machine stack overflow (SIGSEGV) only with
      PTHREAD_STACK_MIN (maybe defined as 2KB).

  Modified files:
    trunk/ChangeLog
    trunk/thread_pthread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32318)
+++ ChangeLog	(revision 32319)
@@ -1,3 +1,10 @@
+Thu Jun 30 12:25:34 2011  Koichi Sasada  <ko1@a...>
+
+	* thread_pthread.c (rb_thread_create_timer_thread): allocate
+	  machine stack for the timer thread at least 12KB.  FreeBSD 8.2
+	  AMD64 causes machine stack overflow (SIGSEGV) only with
+	  PTHREAD_STACK_MIN (maybe defined as 2KB).
+
 Thu Jun 30 09:36:37 2011  Eric Hodel  <drbrain@s...>
 
 	* lib/weakref.rb:  Attach documentation to WeakRef and add missing
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 32318)
+++ thread_pthread.c	(revision 32319)
@@ -1122,8 +1122,18 @@
 
 	pthread_attr_init(&attr);
 #ifdef PTHREAD_STACK_MIN
-	pthread_attr_setstacksize(&attr,
-				  PTHREAD_STACK_MIN + (THREAD_DEBUG ? BUFSIZ : 0));
+	if (PTHREAD_STACK_MIN < 4096 * 3) {
+	    /* Allocate the machine stack for the timer thread
+             * at least 12KB (3 pages).  FreeBSD 8.2 AMD64 causes
+             * machine stack overflow only with PTHREAD_STACK_MIN.
+	     */
+	    pthread_attr_setstacksize(&attr,
+				      4096 * 3 + (THREAD_DEBUG ? BUFSIZ : 0));
+	}
+	else {
+	    pthread_attr_setstacksize(&attr,
+				      PTHREAD_STACK_MIN + (THREAD_DEBUG ? BUFSIZ : 0));
+	}
 #endif
 
 	/* communication pipe with timer thread and signal handler */

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

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