summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorkanemoto <kanemoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-29 17:32:30 +0000
committerkanemoto <kanemoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-29 17:32:30 +0000
commit586720f3113219206bf7b15f956683bdad794402 (patch)
tree346c639bfd9aca7afb457a8227df0ece6b0de4dd /thread_pthread.c
parent921f484775ea2a83462f354b8fff7fc1d5fe1297 (diff)
* thread_pthread.c (get_stack): use pthread_getthrds_np() for AIX.
* configure.in: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index ba90b67010..2136874bd3 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -199,6 +199,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
@@ -248,6 +250,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