aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2008-04-21 20:40:42 +0000
committerMarius Strobl <marius@FreeBSD.org>2008-04-21 20:40:42 +0000
commit7125e147b2f173a832a04853d7572f2b3384b157 (patch)
tree02bde0ed87a57fad6c1e1145ec70141c76f722a3
parentc817ff638d06871d090753c47f0a960a70df47f2 (diff)
downloadsrc-7125e147b2f173a832a04853d7572f2b3384b157.tar.gz
src-7125e147b2f173a832a04853d7572f2b3384b157.zip
* gthr-posix.h (__gthread_active_p): Use the Solaris implementation
for FreeBSD as well. This is the fix for __gthread_active_p() returning false positives which was committed as rev. 1.1.1.8.2.1 to RELENG_7 but now looped back to the vendor branch via the GCC repository and relicensed to be GPLv2 by me. Thanks go to gerald@ for getting the fix approved upstream and for committing to the GCC repository. PR: 119289 Approved by: core
Notes
Notes: svn path=/vendor/gcc/dist/; revision=178388
-rw-r--r--contrib/gcc/gthr-posix.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/contrib/gcc/gthr-posix.h b/contrib/gcc/gthr-posix.h
index 47d38a320bae..fd1ce2204d38 100644
--- a/contrib/gcc/gthr-posix.h
+++ b/contrib/gcc/gthr-posix.h
@@ -152,9 +152,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;
@@ -197,7 +200,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)
@@ -207,7 +210,7 @@ __gthread_active_p (void)
return __gthread_active_ptr != 0;
}
-#endif /* Solaris */
+#endif /* FreeBSD or Solaris */
#else /* not SUPPORTS_WEAK */