summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-30 03:34:16 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-30 03:34:16 +0000
commit51646778414daf9546aff748e6bf0561b050aa5c (patch)
tree0aba31f0eeb8d4c16cd84db26083d6948144c1c1 /thread_pthread.c
parentf680230589fc3645ba91d0d99e5f453cc1b3e191 (diff)
downloadruby-51646778414daf9546aff748e6bf0561b050aa5c.tar.gz
* 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/trunk@32319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index 016ee32abb..9d8f833bbf 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1122,8 +1122,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
/* communication pipe with timer thread and signal handler */