]> Savannah Git Hosting - gnulib.git/commitdiff
thread: Fix compilation error on IRIX.
authorBruno Haible <bruno@clisp.org>
Sat, 17 Feb 2018 08:55:43 +0000 (09:55 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 17 Feb 2018 08:55:43 +0000 (09:55 +0100)
* lib/glthread/thread.h: Include <unistd.h>. Include <signal.h> when
needed; include it outside the C++ extern "C" {} block.
* doc/posix-headers/pthread.texi: Mention the problem with
pthread_atfork on IRIX.

ChangeLog
doc/posix-headers/pthread.texi
lib/glthread/thread.h

index 4774307ccc3e8832096afdfbc8dffd6f6cb6667e..57ab5108c5ac2e12fc8c78fcc5ca3598a8120148 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-02-17  Bruno Haible  <bruno@clisp.org>
+
+       thread: Fix compilation error on IRIX.
+       * lib/glthread/thread.h: Include <unistd.h>. Include <signal.h> when
+       needed; include it outside the C++ extern "C" {} block.
+       * doc/posix-headers/pthread.texi: Mention the problem with
+       pthread_atfork on IRIX.
+
 2018-02-04  Bruno Haible  <bruno@clisp.org>
 
        nl_langinfo: Override the system's nl_langinfo() when needed.
index 7f3913252f6607c280be94688d1a096d694a2fd4..de35b3ba82a14d5e70458ac66c4eb32cd978ced6 100644 (file)
@@ -21,4 +21,8 @@ This header file is missing on some platforms; the replacement does
 not offer threads, so much as lightweight stubs that make conditional
 compilation easier for fallbacks to single-threaded programs.
 Minix 3.1.8, mingw 2.x, MSVC 14, BeOS.
+@item
+This header file lacks the declaration of @code{pthread_atfork} on some
+platforms:
+IRIX 6.5.
 @end itemize
index 165754b4f53dfcaf7f03e56c9251547b4661accf..d8098c4f88db0f6a92d5a3881cfc8059894c44a2 100644 (file)
@@ -90,6 +90,17 @@ _GL_INLINE_HEADER_BEGIN
 
 # include <pthread.h>
 
+/* On IRIX, pthread_atfork is declared in <unistd.h>, not in <pthread.h>.  */
+# if defined __sgi
+#  include <unistd.h>
+# endif
+
+# if USE_POSIX_THREADS_WEAK
+/* Compilers other than GCC need to see the declaration of pthread_sigmask
+   before the "#pragma weak pthread_sigmask" below.  */
+#  include <signal.h>
+# endif
+
 # ifdef __cplusplus
 extern "C" {
 # endif
@@ -124,10 +135,6 @@ extern int glthread_in_use (void);
 
 #  pragma weak pthread_create
 
-#  ifdef __clang__
-  /* Without this, clang complains that pthread_sigmask is never declared.  */
-#   include <signal.h>
-#  endif
 #  ifndef pthread_sigmask /* Do not declare rpl_pthread_sigmask weak.  */
 #   pragma weak pthread_sigmask
 #  endif