aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads/pthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads/pthread.c')
-rw-r--r--linuxthreads/pthread.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 314360d..12ce38b 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -813,8 +813,14 @@ static pthread_descr thread_self_stack(void)
if (sp >= __pthread_manager_thread_bos && sp < __pthread_manager_thread_tos)
return manager_thread;
h = __pthread_handles + 2;
+# ifdef USE_TLS
+ while (h->h_descr == NULL
+ || ! (sp <= (char *) h->h_descr->p_stackaddr && sp >= h->h_bottom))
+ h++;
+# else
while (! (sp <= (char *) h->h_descr && sp >= h->h_bottom))
h++;
+# endif
return h->h_descr;
}