ruby-changes:13921
From: nobu <ko1@a...>
Date: Thu, 12 Nov 2009 13:31:19 +0900 (JST)
Subject: [ruby-changes:13921] Ruby:r25725 (trunk): * thread_pthread.c (native_thread_create): constified.
nobu 2009-11-12 13:31:02 +0900 (Thu, 12 Nov 2009) New Revision: 25725 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25725 Log: * thread_pthread.c (native_thread_create): constified. Modified files: trunk/ChangeLog trunk/thread_pthread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 25724) +++ ChangeLog (revision 25725) @@ -1,3 +1,7 @@ +Thu Nov 12 13:31:00 2009 Nobuyoshi Nakada <nobu@r...> + + * thread_pthread.c (native_thread_create): constified. + Thu Nov 12 10:08:56 2009 NARUSE, Yui <naruse@r...> * .document: remove documents not in rdoc format until Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 25724) +++ thread_pthread.c (revision 25725) @@ -455,6 +455,22 @@ 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 @@ } 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/