From 46f4654b2816f4cea87e093a0aa4dcbc97d2d0b0 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Tue, 10 Aug 2010 15:23:07 +0000 Subject: [PATCH] re PR boehm-gc/34544 (pthread_default_stacksize_np failed.) PR boehm-gc/34544 * gthr-posix.h (__gthread_start): Delete. (__gthread_active_init): Use pthread_default_stacksize_np instead of pthread_create to determine if hpux pthreads are active. * gthr-posix95.h (__gthread_start): Delete. (__gthread_active_init): Likewise use pthread_default_stacksize_np. From-SVN: r163071 --- gcc/ChangeLog | 9 +++++++++ gcc/gthr-posix.h | 20 +++----------------- gcc/gthr-posix95.h | 20 +++----------------- 3 files changed, 15 insertions(+), 34 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c412dbf14f27..48cb95ea00a7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2010-08-10 John David Anglin + + PR boehm-gc/34544 + * gthr-posix.h (__gthread_start): Delete. + (__gthread_active_init): Use pthread_default_stacksize_np instead of + pthread_create to determine if hpux pthreads are active. + * gthr-posix95.h (__gthread_start): Delete. + (__gthread_active_init): Likewise use pthread_default_stacksize_np. + 2010-08-08 John David Anglin * config/pa/pa.c (override_options): Fix warning. diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h index a90dc11e6394..3bf4f06c4908 100644 --- a/gcc/gthr-posix.h +++ b/gcc/gthr-posix.h @@ -237,32 +237,18 @@ __gthread_active_p (void) static volatile int __gthread_active = -1; -static void * -__gthread_start (void *arg __attribute__((unused))) -{ - return NULL; -} - static void __gthread_active_init (void) __attribute__((noinline)); static void __gthread_active_init (void) { static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER; - pthread_t t; - pthread_attr_t a; - int result; + size_t __s; __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex); if (__gthread_active < 0) { - __gthrw_(pthread_attr_init) (&a); - __gthrw_(pthread_attr_setdetachstate) (&a, PTHREAD_CREATE_DETACHED); - result = __gthrw_(pthread_create) (&t, &a, __gthread_start, NULL); - if (result != ENOSYS) - __gthread_active = 1; - else - __gthread_active = 0; - __gthrw_(pthread_attr_destroy) (&a); + pthread_default_stacksize_np (0, &__s); + __gthread_active = __s ? 1 : 0; } __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex); } diff --git a/gcc/gthr-posix95.h b/gcc/gthr-posix95.h index 9d6939eaf916..68712eba3526 100644 --- a/gcc/gthr-posix95.h +++ b/gcc/gthr-posix95.h @@ -200,32 +200,18 @@ __gthread_active_p (void) static volatile int __gthread_active = -1; -static void * -__gthread_start (void *arg __attribute__((unused))) -{ - return NULL; -} - static void __gthread_active_init (void) __attribute__((noinline)); static void __gthread_active_init (void) { static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER; - pthread_t t; - pthread_attr_t a; - int result; + size_t __s; __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex); if (__gthread_active < 0) { - __gthrw_(pthread_attr_init) (&a); - __gthrw_(pthread_attr_setdetachstate) (&a, PTHREAD_CREATE_DETACHED); - result = __gthrw_(pthread_create) (&t, &a, __gthread_start, NULL); - if (result != ENOSYS) - __gthread_active = 1; - else - __gthread_active = 0; - __gthrw_(pthread_attr_destroy) (&a); + pthread_default_stacksize_np (0, &__s); + __gthread_active = __s ? 1 : 0; } __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex); } -- 2.47.2