]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Revert:
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Sat, 14 Aug 2010 14:36:47 +0000 (14:36 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sat, 14 Aug 2010 14:36:47 +0000 (14:36 +0000)
2010-08-10  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.

From-SVN: r163242

gcc/ChangeLog
gcc/gthr-posix.h
gcc/gthr-posix95.h

index bec37a0c9b45aee3b95f089e9e6b340ea42e77b1..fa4a13ec845438a8119b1de30a312f360613bf11 100644 (file)
@@ -1,3 +1,15 @@
+2010-08-14  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       Revert:
+       2010-08-10  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-11  Richard Guenther  <rguenther@suse.de>
 
        PR c/44555
index 3bf4f06c4908ea8d7df470e9c0ce536188771f56..a90dc11e6394b6af52c78d8c7d2f5361141ab2b8 100644 (file)
@@ -237,18 +237,32 @@ __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;
-  size_t __s;
+  pthread_t t;
+  pthread_attr_t a;
+  int result;
 
   __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
   if (__gthread_active < 0)
     {
-      pthread_default_stacksize_np (0, &__s);
-      __gthread_active = __s ? 1 : 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);
     }
   __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
 }
index 68712eba352654c8760fa6fe632597ab72e0d822..9d6939eaf9167863bf2e522f41734f9772ee00a2 100644 (file)
@@ -200,18 +200,32 @@ __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;
-  size_t __s;
+  pthread_t t;
+  pthread_attr_t a;
+  int result;
 
   __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
   if (__gthread_active < 0)
     {
-      pthread_default_stacksize_np (0, &__s);
-      __gthread_active = __s ? 1 : 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);
     }
   __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
 }