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_stack): use pthread_getthrds_np() for AIX.

* configure.in: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kanemoto 2010-06-29 17:29:27 +00:00
parent a9ffa5cecf
commit 78d48a330d
3 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Wed Jun 30 02:30:26 2010 Yutaka Kanemoto <kanemoto@ruby-lang.org>
* thread_pthread.c (get_stack): use pthread_getthrds_np() for AIX.
* configure.in: ditto.
Tue Jun 29 21:11:15 2010 Masaya Tarui <tarui@ruby-lnag.org>
* ext/stringio/stringio.c (strio_write): add RB_GC_GUARD.

View file

@ -1568,7 +1568,7 @@ if test x"$enable_pthread" = xyes; then
AC_CHECK_FUNCS(nanosleep sched_yield pthread_attr_setinheritsched \
pthread_getattr_np pthread_attr_get_np pthread_attr_getstack\
pthread_get_stackaddr_np pthread_get_stacksize_np \
thr_stksegment pthread_stackseg_np)
thr_stksegment pthread_stackseg_np pthread_getthrds_np)
if test x"$ac_cv_func_nanosleep" = xno; then
AC_CHECK_LIB(rt, nanosleep)
if test x"$ac_cv_lib_rt_nanosleep" = xyes; then

View file

@ -191,6 +191,8 @@ native_thread_destroy(rb_thread_t *th)
#define STACKADDR_AVAILABLE 1
#elif defined HAVE_THR_STKSEGMENT || defined HAVE_PTHREAD_STACKSEG_NP
#define STACKADDR_AVAILABLE 1
#elif defined HAVE_PTHREAD_GETTHRDS_NP
#define STACKADDR_AVAILABLE 1
#endif
#ifdef STACKADDR_AVAILABLE
@ -240,6 +242,16 @@ get_stack(void **addr, size_t *size)
# endif
*addr = stk.ss_sp;
*size = stk.ss_size;
#elif defined HAVE_PTHREAD_GETTHRDS_NP
pthread_t th = pthread_self();
struct __pthrdsinfo thinfo;
char reg[256];
int regsiz=sizeof(reg);
CHECK_ERR(pthread_getthrds_np(&th, PTHRDSINFO_QUERY_ALL,
&thinfo, sizeof(thinfo),
&reg, &regsiz));
*addr = thinfo.__pi_stackaddr;
*size = thinfo.__pi_stacksize;
#endif
return 0;
#undef CHECK_ERR