summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-03 06:33:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-03 06:33:08 +0000
commit54c17dc8a979ce072991e4480e5ae3d70bad9b2a (patch)
tree26d0018fdde0d763db63b80088e324119efebf9d /thread_pthread.c
parent5c677a83bab95b01a0c5d6d3eda9e26e8e43fab2 (diff)
thread_pthread.c: init stack with ulimit
* thread_pthread.c (ruby_init_stack): use getrlimit() for the main thread on Mac OS X, since pthread_get_stack{addr,size}_np() and return the default value always, but not the ulimit value. [ruby-dev:46174] [Bug #7084] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index be6b017e50..ab227e32b3 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -492,6 +492,8 @@ static rb_thread_t *register_cached_thread_and_wait(void);
#define STACKADDR_AVAILABLE 1
#elif defined HAVE_PTHREAD_GET_STACKADDR_NP && defined HAVE_PTHREAD_GET_STACKSIZE_NP
#define STACKADDR_AVAILABLE 1
+#undef MAINSTACKADDR_AVAILABLE
+#define MAINSTACKADDR_AVAILABLE 0
void *pthread_get_stackaddr_np(pthread_t);
size_t pthread_get_stacksize_np(pthread_t);
#elif defined HAVE_THR_STKSEGMENT || defined HAVE_PTHREAD_STACKSEG_NP
@@ -500,6 +502,14 @@ size_t pthread_get_stacksize_np(pthread_t);
#define STACKADDR_AVAILABLE 1
#endif
+#ifndef MAINSTACKADDR_AVAILABLE
+# ifdef STACKADDR_AVAILABLE
+# define MAINSTACKADDR_AVAILABLE 1
+# else
+# define MAINSTACKADDR_AVAILABLE 0
+# endif
+#endif
+
#ifdef STACKADDR_AVAILABLE
/*
* Get the initial address and size of current thread's stack
@@ -614,7 +624,7 @@ ruby_init_stack(volatile VALUE *addr
{
size_t size = 0;
size_t space = 0;
-#if defined(STACKADDR_AVAILABLE)
+#if MAINSTACKADDR_AVAILABLE
void* stackaddr;
STACK_GROW_DIR_DETECTION;
get_stack(&stackaddr, &size);