mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* thread_pthread.c (get_stack): pthread_attr_getstack() doesn't
return stack start addres, but stack base address. Thus, we need to add stack size for getting stack start address. And, we don't have to decrease guard size twice. * thread_pthread.c (thread_start_func_1): don't use inaccurate stack start guess if native_thread_init_stack() can be used. [Bug #1813] [ruby-core:24540] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
560c1aeba9
commit
70dd402cd8
2 changed files with 23 additions and 8 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Sun Jul 3 06:10:26 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* thread_pthread.c (get_stack): pthread_attr_getstack() doesn't
|
||||
return stack start addres, but stack base address. Thus,
|
||||
we need to add stack size for getting stack start address.
|
||||
And, we don't have to decrease guard size twice.
|
||||
* thread_pthread.c (thread_start_func_1): don't use inaccurate
|
||||
stack start guess if native_thread_init_stack() can be used.
|
||||
[Bug #1813] [ruby-core:24540]
|
||||
|
||||
Sun Jul 3 04:50:08 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* thread_pthread.c (get_stack): add to a care of gurad page on Mac
|
||||
|
|
|
@ -463,19 +463,16 @@ get_stack(void **addr, size_t *size)
|
|||
pthread_attr_t attr;
|
||||
size_t guard = 0;
|
||||
|
||||
# ifdef HAVE_PTHREAD_GETATTR_NP
|
||||
# ifdef HAVE_PTHREAD_GETATTR_NP /* Linux */
|
||||
STACK_GROW_DIR_DETECTION;
|
||||
CHECK_ERR(pthread_getattr_np(pthread_self(), &attr));
|
||||
# ifdef HAVE_PTHREAD_ATTR_GETSTACK /* Linux */
|
||||
# ifdef HAVE_PTHREAD_ATTR_GETSTACK
|
||||
CHECK_ERR(pthread_attr_getstack(&attr, addr, size));
|
||||
STACK_DIR_UPPER((void)0, (void)(*addr = (char *)*addr + *size));
|
||||
# else
|
||||
CHECK_ERR(pthread_attr_getstackaddr(&attr, addr));
|
||||
CHECK_ERR(pthread_attr_getstacksize(&attr, size));
|
||||
# endif
|
||||
if (pthread_attr_getguardsize(&attr, &guard) == 0) {
|
||||
STACK_GROW_DIR_DETECTION;
|
||||
STACK_DIR_UPPER((void)0, (void)(*addr = (char *)*addr + guard));
|
||||
*size -= guard;
|
||||
}
|
||||
# elif defined HAVE_PTHREAD_ATTR_GET_NP /* FreeBSD, DragonFly BSD, NetBSD */
|
||||
CHECK_ERR(pthread_attr_init(&attr));
|
||||
CHECK_ERR(pthread_attr_get_np(pthread_self(), &attr));
|
||||
|
@ -603,6 +600,10 @@ native_thread_init_stack(rb_thread_t *th)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
#define USE_NATIVE_THREAD_INIT 1
|
||||
#endif
|
||||
|
||||
static void *
|
||||
thread_start_func_1(void *th_ptr)
|
||||
{
|
||||
|
@ -613,12 +614,16 @@ thread_start_func_1(void *th_ptr)
|
|||
rb_thread_t *th = th_ptr;
|
||||
VALUE stack_start;
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
#if defined USE_NATIVE_THREAD_INIT
|
||||
native_thread_init_stack(th);
|
||||
#endif
|
||||
native_thread_init(th);
|
||||
/* run */
|
||||
#if defined USE_NATIVE_THREAD_INIT
|
||||
thread_start_func_2(th, th->machine_stack_start, rb_ia64_bsp());
|
||||
#else
|
||||
thread_start_func_2(th, &stack_start, rb_ia64_bsp());
|
||||
#endif
|
||||
}
|
||||
#if USE_THREAD_CACHE
|
||||
if (1) {
|
||||
|
|
Loading…
Add table
Reference in a new issue