From 03f06aa7affc76868bd306b3e521219d6a12b5dd Mon Sep 17 00:00:00 2001 From: yugui Date: Thu, 11 Aug 2011 00:38:47 +0000 Subject: merges r32319 from trunk into ruby_1_9_2. -- * 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). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@32921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ thread_pthread.c | 14 ++++++++++++-- version.h | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa87ec6381..bf2091ed3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Jun 30 12:25:34 2011 Koichi Sasada + + * 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 01:31:33 2011 KOSAKI Motohiro * thread.c (thread_s_pass): change RDoc description and remove diff --git a/thread_pthread.c b/thread_pthread.c index d3c2609a12..cf054f5e44 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -835,8 +835,18 @@ rb_thread_create_timer_thread(void) 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 native_mutex_lock(&timer_thread_lock); err = pthread_create(&timer_thread_id, &attr, thread_timer, 0); diff --git a/version.h b/version.h index b392f92efe..00c69db359 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 306 +#define RUBY_PATCHLEVEL 307 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -- cgit v1.2.3