Module Name:    src
Committed By:   christos
Date:           Sat Feb  9 01:27:43 UTC 2019

Modified Files:
        src/external/gpl3/gcc/dist/libgcc: gthr-posix.h

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


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 src/external/gpl3/gcc/dist/libgcc/gthr-posix.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libgcc/gthr-posix.h
diff -u src/external/gpl3/gcc/dist/libgcc/gthr-posix.h:1.1.1.4 src/external/gpl3/gcc/dist/libgcc/gthr-posix.h:1.2
--- src/external/gpl3/gcc/dist/libgcc/gthr-posix.h:1.1.1.4	Sat Jan 19 05:14:14 2019
+++ src/external/gpl3/gcc/dist/libgcc/gthr-posix.h	Fri Feb  8 20:27:43 2019
@@ -164,9 +164,12 @@ __gthrw(pthread_setschedparam)
    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 @@ __gthread_active_p (void)
   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 @@ __gthread_active_p (void)
   return __gthread_active_ptr != 0;
 }
 
-#endif /* FreeBSD or Solaris */
+#endif /* FreeBSD or Solaris or NetBSD */
 
 #else /* not SUPPORTS_WEAK */
 

Reply via email to