diff options
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 12 |
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), + ®, ®siz)); + *addr = thinfo.__pi_stackaddr; + *size = thinfo.__pi_stacksize; #endif return 0; #undef CHECK_ERR |