summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorkanemoto <kanemoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-29 17:29:27 +0000
committerkanemoto <kanemoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-29 17:29:27 +0000
commit78d48a330d481948f1d899d72ae5b122b7756533 (patch)
tree86c815c8301a9a8760623aa92fd55484c206c8d8 /thread_pthread.c
parenta9ffa5cecf5e84d78cfc5ecd9b1dcaedb162a1fa (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/trunk@28485 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 c2a555aa6c..99edbc62e1 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -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