summaryrefslogtreecommitdiff
path: root/gcc/gthr-posix.h
diff options
context:
space:
mode:
authorgerald <gerald@138bc75d-0d04-0410-961f-82ee72b054a4>2008-04-18 02:16:35 +0000
committergerald <gerald@138bc75d-0d04-0410-961f-82ee72b054a4>2008-04-18 02:16:35 +0000
commit4f364038e71ee1af10da6b8218006346215f7275 (patch)
treed97072b705682b99c3bac4021c85f16d54ca9c21 /gcc/gthr-posix.h
parent33fb64b5a148a32645ff44224299430282446e34 (diff)
downloadgcc-4f364038e71ee1af10da6b8218006346215f7275.tar.gz
* gthr-posix.h (__gthread_active_p): Use the Solaris implementation
for FreeBSD as well. * gthr-posix95.h: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134423 138bc75d-0d04-0410-961f-82ee72b054a4
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 */