summaryrefslogtreecommitdiff
path: root/gcc/gthr-posix.h
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2008-04-18 02:16:35 +0000
committerGerald Pfeifer <gerald@gcc.gnu.org>2008-04-18 02:16:35 +0000
commit799cff46ec8fe37c60605f22d8a9d6a39dcdb364 (patch)
treed97072b705682b99c3bac4021c85f16d54ca9c21 /gcc/gthr-posix.h
parent57b256d993797dfaa46995aed0d3d74d288729fc (diff)
downloadgcc-799cff46ec8fe37c60605f22d8a9d6a39dcdb364.tar.gz
gthr-posix.h (__gthread_active_p): Use the Solaris implementation for FreeBSD as well.
* gthr-posix.h (__gthread_active_p): Use the Solaris implementation for FreeBSD as well. * gthr-posix95.h: Likewise. From-SVN: r134423
Diffstat (limited to 'gcc/gthr-posix.h')
-rw-r--r--gcc/gthr-posix.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h
index a6c9ba3b54f..b16f9b31fe8 100644
--- a/gcc/gthr-posix.h
+++ b/gcc/gthr-posix.h
@@ -158,9 +158,12 @@ __gthrw(pthread_setschedparam)
it is passed so we cannot pretend that the interface is active if -pthreads
is not specified. On Solaris 2.5.1, the interface is not exposed at all so
we need to play the usual game with weak symbols. On Solaris 10 and up, a
- working interface is always exposed. */
+ working interface is always exposed. On FreeBSD 6 and later, libc also
+ exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
+ to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
+ which means the alternate __gthread_active_p below cannot be used there. */
-#if defined(__sun) && defined(__svr4__)
+#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
static volatile int __gthread_active = -1;
@@ -203,7 +206,7 @@ __gthread_active_p (void)
return __gthread_active_latest_value != 0;
}
-#else /* not Solaris */
+#else /* neither FreeBSD nor Solaris */
static inline int
__gthread_active_p (void)
@@ -213,7 +216,7 @@ __gthread_active_p (void)
return __gthread_active_ptr != 0;
}
-#endif /* Solaris */
+#endif /* FreeBSD or Solaris */
#else /* not SUPPORTS_WEAK */