1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2013-08-30 13:37:46 +00:00
parent 51f09f15c3
commit 7703ba8544
2 changed files with 21 additions and 1 deletions

View file

@ -1,3 +1,20 @@
Fri Aug 30 22:37:40 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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 <ko1@atdot.net> Thu Aug 29 18:05:33 2013 Koichi Sasada <ko1@atdot.net>
* struct.c (rb_struct_define_without_accessor_under): added. * struct.c (rb_struct_define_without_accessor_under): added.

View file

@ -544,6 +544,9 @@ hpux_attr_getstackaddr(const pthread_attr_t *attr, void *addr)
# define MAINSTACKADDR_AVAILABLE 0 # define MAINSTACKADDR_AVAILABLE 0
# endif # endif
#endif #endif
#if MAINSTACKADDR_AVAILABLE && !defined(get_main_stack)
# define get_main_stack(addr, size) get_stack(addr, size)
#endif
#ifdef STACKADDR_AVAILABLE #ifdef STACKADDR_AVAILABLE
/* /*
@ -685,7 +688,7 @@ ruby_init_stack(volatile VALUE *addr
#if MAINSTACKADDR_AVAILABLE #if MAINSTACKADDR_AVAILABLE
void* stackaddr; void* stackaddr;
STACK_GROW_DIR_DETECTION; 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); space = STACK_DIR_UPPER((char *)addr - (char *)stackaddr, (char *)stackaddr - (char *)addr);
} }
native_main_thread.stack_maxsize = size - space; native_main_thread.stack_maxsize = size - space;