From: Bruno Haible Date: Sat, 17 Feb 2018 08:55:43 +0000 (+0100) Subject: thread: Fix compilation error on IRIX. X-Git-Tag: v1.0~5736 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=67489d768793808b7165ff1e32195e983cba2ead;p=gnulib.git thread: Fix compilation error on IRIX. * lib/glthread/thread.h: Include . Include when needed; include it outside the C++ extern "C" {} block. * doc/posix-headers/pthread.texi: Mention the problem with pthread_atfork on IRIX. --- diff --git a/ChangeLog b/ChangeLog index 4774307ccc..57ab5108c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-02-17 Bruno Haible + + thread: Fix compilation error on IRIX. + * lib/glthread/thread.h: Include . Include 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 nl_langinfo: Override the system's nl_langinfo() when needed. diff --git a/doc/posix-headers/pthread.texi b/doc/posix-headers/pthread.texi index 7f3913252f..de35b3ba82 100644 --- a/doc/posix-headers/pthread.texi +++ b/doc/posix-headers/pthread.texi @@ -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 diff --git a/lib/glthread/thread.h b/lib/glthread/thread.h index 165754b4f5..d8098c4f88 100644 --- a/lib/glthread/thread.h +++ b/lib/glthread/thread.h @@ -90,6 +90,17 @@ _GL_INLINE_HEADER_BEGIN # include +/* On IRIX, pthread_atfork is declared in , not in . */ +# if defined __sgi +# include +# 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 +# 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 -# endif # ifndef pthread_sigmask /* Do not declare rpl_pthread_sigmask weak. */ # pragma weak pthread_sigmask # endif