ruby-changes:32596
From: nobu <ko1@a...>
Date: Tue, 21 Jan 2014 20:14:58 +0900 (JST)
Subject: [ruby-changes:32596] nobu:r44675 (trunk): thread_pthread.c: fix for dynamic PTHREAD_STACK_MIN
nobu 2014-01-21 20:14:54 +0900 (Tue, 21 Jan 2014) New Revision: 44675 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44675 Log: thread_pthread.c: fix for dynamic PTHREAD_STACK_MIN * thread_pthread.c (rb_thread_create_timer_thread): fix for platforms where PTHREAD_STACK_MIN is a dynamic value and not a compile-time constant. [ruby-dev:47911] [Bug #9436] Modified files: trunk/ChangeLog trunk/thread_pthread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 44674) +++ ChangeLog (revision 44675) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Jan 21 20:14:55 2014 Nobuyoshi Nakada <nobu@r...> + + * thread_pthread.c (rb_thread_create_timer_thread): fix for platforms + where PTHREAD_STACK_MIN is a dynamic value and not a compile-time + constant. [ruby-dev:47911] [Bug #9436] + Tue Jan 21 17:55:09 2014 Zachary Scott <e@z...> * lib/uri/common.rb: [DOC] Use static w3.org uri [ci skip] Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 44674) +++ thread_pthread.c (revision 44675) @@ -1480,17 +1480,15 @@ rb_thread_create_timer_thread(void) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1480 } # ifdef PTHREAD_STACK_MIN { -# define TIMER_THREAD_STACK_MIN_SIZE (4096 * 4) + const size_t min_size = (4096 * 4); /* Allocate the machine stack for the timer thread * at least 16KB (4 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, - TIMER_THREAD_STACK_MIN_SIZE + (THREAD_DEBUG ? BUFSIZ : 0)); + size_t stack_size = PTHREAD_STACK_MIN; /* may be dynamic, get only once */ + if (stack_size < min_size) stack_size = min_size; + if (THREAD_DEBUG) stack_size += BUFSIZ; + pthread_attr_setstacksize(&attr, stack_size); } # endif #endif -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/