+2011-07-08 Bruno Haible <bruno@clisp.org>
+
+ pthread_sigmask: Work around Cygwin bug.
+ * m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Test for the Cygwin
+ bug.
+ * lib/pthread_sigmask.c (pthread_sigmask): Fix the return value from
+ the system's pthread_sigmask function.
+ * doc/posix-functions/pthread_sigmask.texi: Mention the Cygwin bug.
+
2011-07-08 Bruno Haible <bruno@clisp.org>
pthread_sigmask: Work around bug in single-threaded implementation.
This function does nothing and always returns 0 in programs that are not
linked with @code{-lpthread} on some platforms:
FreeBSD 6.4, HP-UX 11.31, Solaris 9.
+@item
+When it fails, this functions returns -1 instead of the error number on
+some platforms:
+Cygwin 1.7.5.
@end itemize
Portability problems not fixed by Gnulib:
;;
esac
fi
+
+ dnl On Cygwin 1.7.5, the pthread_sigmask() has a wrong return value
+ dnl convention: Upon failure, it returns -1 and sets errno.
+ AC_CACHE_CHECK([whether pthread_sigmask returns error numbers],
+ [gl_cv_func_pthread_sigmask_return_works],
+ [
+ gl_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIB_PTHREAD_SIGMASK"
+ AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <pthread.h>
+#include <signal.h>
+#include <stddef.h>
+int main ()
+{
+ sigset_t set;
+ sigemptyset (&set);
+ if (pthread_sigmask (1729, &set, NULL) == -1)
+ return 1;
+ return 0;
+}]])],
+ [gl_cv_func_pthread_sigmask_return_works=yes],
+ [gl_cv_func_pthread_sigmask_return_works=no],
+ [case "$host_os" in
+ cygwin*)
+ gl_cv_func_pthread_sigmask_return_works="guessing no";;
+ *)
+ gl_cv_func_pthread_sigmask_return_works="guessing yes";;
+ esac
+ ])
+ LIBS="$gl_save_LIBS"
+ ])
+ case "$gl_cv_func_pthread_sigmask_return_works" in
+ *no)
+ REPLACE_PTHREAD_SIGMASK=1
+ AC_DEFINE([PTHREAD_SIGMASK_FAILS_WITH_ERRNO], [1],
+ [Define to 1 if pthread_mask(), when it fails, returns -1 and sets errno.])
+ ;;
+ esac
+
fi
])