diff options
author | John David Anglin <dave.anglin@nrc-cnrc.gc.ca> | 2007-10-12 00:09:10 +0000 |
---|---|---|
committer | John David Anglin <danglin@gcc.gnu.org> | 2007-10-12 00:09:10 +0000 |
commit | d796bfa95cbd60745f2131875283870e3703fc0c (patch) | |
tree | 96d1a495e5c05f428f9fc1f5f90dd3d1f9669f92 | |
parent | 8885751219b7aa0391a53af06a1d05b215cb048e (diff) | |
download | gcc-d796bfa95cbd60745f2131875283870e3703fc0c.zip gcc-d796bfa95cbd60745f2131875283870e3703fc0c.tar.gz gcc-d796bfa95cbd60745f2131875283870e3703fc0c.tar.bz2 |
gthr-posix.h (__gthread_active_init): Create detached instead of joinable thread when...
* gthr-posix.h (__gthread_active_init): Create detached instead of
joinable thread when testing whether threads are active on hppa-hpux.
* gthr-posix95.h (__gthread_active_init): Likewise.
From-SVN: r129246
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gthr-posix.h | 12 | ||||
-rw-r--r-- | gcc/gthr-posix95.h | 12 |
3 files changed, 18 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dac597f..a527279 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-10-11 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * gthr-posix.h (__gthread_active_init): Create detached instead of + joinable thread when testing whether threads are active on hppa-hpux. + * gthr-posix95.h (__gthread_active_init): Likewise. + 2007-10-11 Kenneth Zadeck <zadeck@naturalbridge.com> PR middle-end/33676 diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h index 5c00cd3..ad6822e 100644 --- a/gcc/gthr-posix.h +++ b/gcc/gthr-posix.h @@ -246,20 +246,20 @@ __gthread_active_init (void) { static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_t t; + pthread_attr_t a; int result; __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex); if (__gthread_active < 0) { - result = __gthrw_(pthread_create) (&t, NULL, __gthread_start, NULL); + __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; - if (!result) - __gthrw_(pthread_join) (t, NULL); - } + __gthread_active = 1; else __gthread_active = 0; + __gthrw_(pthread_attr_destroy) (&a); } __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex); } diff --git a/gcc/gthr-posix95.h b/gcc/gthr-posix95.h index df250d2..eb54c92 100644 --- a/gcc/gthr-posix95.h +++ b/gcc/gthr-posix95.h @@ -209,20 +209,20 @@ __gthread_active_init (void) { static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_t t; + pthread_attr_t a; int result; __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex); if (__gthread_active < 0) { - result = __gthrw_(pthread_create) (&t, NULL, __gthread_start, NULL); + __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; - if (!result) - __gthrw_(pthread_join) (t, NULL); - } + __gthread_active = 1; else __gthread_active = 0; + __gthrw_(pthread_attr_destroy) (&a); } __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex); } |