diff options
author | John David Anglin <dave.anglin@nrc-cnrc.gc.ca> | 2010-08-08 15:04:38 +0000 |
---|---|---|
committer | John David Anglin <danglin@gcc.gnu.org> | 2010-08-08 15:04:38 +0000 |
commit | cf00499e1927b09933965b959da6054e8f76e319 (patch) | |
tree | 27d3b82d21dd8bcbe0c49eef67e5a230f30cba82 | |
parent | 71234632dd6ff182f7ce6ed2fe250d3f40038c81 (diff) | |
download | gcc-cf00499e1927b09933965b959da6054e8f76e319.tar.gz |
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: r163003
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/gthr-posix.h | 20 | ||||
-rw-r--r-- | gcc/gthr-posix95.h | 20 |
3 files changed, 15 insertions, 34 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 249192a8c26..e4ce02754ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2010-08-08 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + 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 Kai Tietz <kai.tietz@onevision.com> * config/i386/mingw32.h ((EXTRA_OS_CPP_BUILTINS): Define diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h index a7ce3111802..f7f240f5275 100644 --- a/gcc/gthr-posix.h +++ b/gcc/gthr-posix.h @@ -273,32 +273,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 55e254eb21f..d0e0f995f1b 100644 --- a/gcc/gthr-posix95.h +++ b/gcc/gthr-posix95.h @@ -197,32 +197,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); } |