summaryrefslogtreecommitdiffstats
path: root/gcc/gthr-posix.h
diff options
context:
space:
mode:
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-12 00:09:10 +0000
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2007-10-12 00:09:10 +0000
commit3086067c9aee542a6d8a3c6778004916158e8b42 (patch)
tree96d1a495e5c05f428f9fc1f5f90dd3d1f9669f92 /gcc/gthr-posix.h
parentc4aecd09588fb5b758b912e43f3bf57564107682 (diff)
downloadppe42-gcc-3086067c9aee542a6d8a3c6778004916158e8b42.tar.gz
ppe42-gcc-3086067c9aee542a6d8a3c6778004916158e8b42.zip
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129246 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gthr-posix.h')
-rw-r--r--gcc/gthr-posix.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h
index 5c00cd30862..ad6822e26ad 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);
}
OpenPOWER on IntegriCloud