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
This commit is contained in:
parent
8885751219
commit
d796bfa95c
3 changed files with 18 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue