From 7703ba8544c485b1ae1fcafbdff1566e9d78a7a2 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 30 Aug 2013 13:37:46 +0000 Subject: thread_pthread.c: get_main_stack * thread_pthread.c (get_main_stack): separate function to get stack of main thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 17 +++++++++++++++++ thread_pthread.c | 5 ++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a7683a09e9..be866048be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +Fri Aug 30 22:37:40 2013 Nobuyoshi Nakada + + * thread_pthread.c (get_main_stack): separate function to get stack of + main thread. + + * thread_pthread.c (native_thread_init_stack): wait the creator thread + to fill machine stack info, if get_stack_of() is available. + + * thread_pthread.c (native_thread_create): fill the created thread + stack info after starting, if get_stack_of() is available. + + * thread_pthread.c (native_thread_create): define attr only if it is + used, and merge pthread_create() calls. + + * thread_pthread.c (get_main_stack): separate function to get stack of + main thread. + Thu Aug 29 18:05:33 2013 Koichi Sasada * struct.c (rb_struct_define_without_accessor_under): added. diff --git a/thread_pthread.c b/thread_pthread.c index 1e6b80ae49..19b3fb790f 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -544,6 +544,9 @@ hpux_attr_getstackaddr(const pthread_attr_t *attr, void *addr) # define MAINSTACKADDR_AVAILABLE 0 # endif #endif +#if MAINSTACKADDR_AVAILABLE && !defined(get_main_stack) +# define get_main_stack(addr, size) get_stack(addr, size) +#endif #ifdef STACKADDR_AVAILABLE /* @@ -685,7 +688,7 @@ ruby_init_stack(volatile VALUE *addr #if MAINSTACKADDR_AVAILABLE void* stackaddr; STACK_GROW_DIR_DETECTION; - if (get_stack(&stackaddr, &size) == 0) { + if (get_main_stack(&stackaddr, &size) == 0) { space = STACK_DIR_UPPER((char *)addr - (char *)stackaddr, (char *)stackaddr - (char *)addr); } native_main_thread.stack_maxsize = size - space; -- cgit v1.2.3