Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gcc/dist/libgcc Follow suit with FreeBSD and s...



details:   https://anonhg.NetBSD.org/src/rev/74014ff723d8
branches:  trunk
changeset: 839184:74014ff723d8
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Feb 09 01:27:43 2019 +0000

description:
Follow suit with FreeBSD and solaris for the __gthread_active_p()
implementation. Fixes the atf call_once unit tests.

diffstat:

 external/gpl3/gcc/dist/libgcc/gthr-posix.h |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r ae8410a3f234 -r 74014ff723d8 external/gpl3/gcc/dist/libgcc/gthr-posix.h
--- a/external/gpl3/gcc/dist/libgcc/gthr-posix.h        Sat Feb 09 00:59:30 2019 +0000
+++ b/external/gpl3/gcc/dist/libgcc/gthr-posix.h        Sat Feb 09 01:27:43 2019 +0000
@@ -164,9 +164,12 @@
    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.  */
+   which means the alternate __gthread_active_p below cannot be used there. 
+   On NetBSD, linking with pthreads but without calling pthread_create()
+   makes std::call_once() so we do the same.
+*/
 
-#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
+#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__)) || defined(__NetBSD)
 
 static volatile int __gthread_active = -1;
 
@@ -209,7 +212,7 @@
   return __gthread_active_latest_value != 0;
 }
 
-#else /* neither FreeBSD nor Solaris */
+#else /* neither FreeBSD nor Solaris nor NetBSD */
 
 /* For a program to be multi-threaded the only thing that it certainly must
    be using is pthread_create.  However, there may be other libraries that
@@ -251,7 +254,7 @@
   return __gthread_active_ptr != 0;
 }
 
-#endif /* FreeBSD or Solaris */
+#endif /* FreeBSD or Solaris or NetBSD */
 
 #else /* not SUPPORTS_WEAK */
 



Home | Main Index | Thread Index | Old Index