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

ruby-changes:32591

From: nobu <ko1@a...>
Date: Tue, 21 Jan 2014 16:26:50 +0900 (JST)
Subject: [ruby-changes:32591] nobu:r44670 (trunk): thread_pthread.c: timer thread stack size

nobu	2014-01-21 16:26:46 +0900 (Tue, 21 Jan 2014)

  New Revision: 44670

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

  Log:
    thread_pthread.c: timer thread stack size
    
    * thread_pthread.c (rb_thread_create_timer_thread): define the stack
      size for timer thread at compile time.

  Modified files:
    trunk/thread_pthread.c
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 44669)
+++ thread_pthread.c	(revision 44670)
@@ -1479,17 +1479,18 @@ rb_thread_create_timer_thread(void) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1479
 	    exit(EXIT_FAILURE);
         }
 # ifdef PTHREAD_STACK_MIN
-	if (PTHREAD_STACK_MIN < 4096 * 3) {
+	{
+#   define TIMER_THREAD_STACK_MIN_SIZE (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.
+	     * at least 12KB (3 pages).  FreeBSD 8.2 AMD64 causes
+	     * machine stack overflow only with PTHREAD_STACK_MIN.
 	     */
+#   if TIMER_THREAD_STACK_MIN_SIZE < PTHREAD_STACK_MIN
+#     undef TIMER_THREAD_STACK_MIN_SIZE
+#     define TIMER_THREAD_STACK_MIN_SIZE PTHREAD_STACK_MIN
+#   endif
 	    pthread_attr_setstacksize(&attr,
-				      4096 * 3 + (THREAD_DEBUG ? BUFSIZ : 0));
-	}
-	else {
-	    pthread_attr_setstacksize(&attr,
-				      PTHREAD_STACK_MIN + (THREAD_DEBUG ? BUFSIZ : 0));
+				      TIMER_THREAD_STACK_MIN_SIZE + (THREAD_DEBUG ? BUFSIZ : 0);
 	}
 # endif
 #endif

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

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