summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-12 04:31:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-12 04:31:02 +0000
commita360a8ce853ac66b822ceaf4453128891f7f2f62 (patch)
tree614c098966923f373bd82b99916b7f365289c1a9
parent5e5b4c08fcf0729aa0342dd3a002c38047ea1418 (diff)
* thread_pthread.c (native_thread_create): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--thread_pthread.c31
2 files changed, 22 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index b52cddd5c4..b34dfdef7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Nov 12 13:31:00 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (native_thread_create): constified.
+
Thu Nov 12 10:08:56 2009 NARUSE, Yui <naruse@ruby-lang.org>
* .document: remove documents not in rdoc format until
diff --git a/thread_pthread.c b/thread_pthread.c
index 2273d2062c..22db6d9f83 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -455,6 +455,22 @@ use_cached_thread(rb_thread_t *th)
return result;
}
+enum {
+#ifdef __SYMBIAN32__
+ RUBY_STACK_MIN_LIMIT = 64 * 1024, /* 64KB: Let's be slightly more frugal on mobile platform */
+#else
+ RUBY_STACK_MIN_LIMIT = 512 * 1024, /* 512KB */
+#endif
+ RUBY_STACK_MIN = (
+#ifdef PTHREAD_STACK_MIN
+ (RUBY_STACK_MIN_LIMIT < PTHREAD_STACK_MIN) ? PTHREAD_STACK_MIN * 2 :
+#endif
+ RUBY_STACK_MIN_LIMIT),
+ RUBY_STACK_SPACE_LIMIT = 1024 * 1024,
+ RUBY_STACK_SPACE = (RUBY_STACK_MIN/5 > RUBY_STACK_SPACE_LIMIT ?
+ RUBY_STACK_SPACE_LIMIT : RUBY_STACK_MIN/5),
+};
+
static int
native_thread_create(rb_thread_t *th)
{
@@ -465,20 +481,9 @@ native_thread_create(rb_thread_t *th)
}
else {
pthread_attr_t attr;
-#ifdef __SYMBIAN32__
- size_t stack_size = 64 * 1024; /* 64KB: Let's be slightly more frugal on mobile platform */
-#else
- size_t stack_size = 512 * 1024; /* 512KB */
-#endif
- size_t space;
+ const size_t stack_size = RUBY_STACK_MIN;
+ const size_t space = RUBY_STACK_SPACE;
-#ifdef PTHREAD_STACK_MIN
- if (stack_size < PTHREAD_STACK_MIN) {
- stack_size = PTHREAD_STACK_MIN * 2;
- }
-#endif
- space = stack_size/5;
- if (space > 1024*1024) space = 1024*1024;
th->machine_stack_maxsize = stack_size - space;
#ifdef __ia64
th->machine_stack_maxsize /= 2;