Mercurial > hg > octave-lyh > gnulib-hg
changeset 15343:107f8443e77a
pthread_sigmask: new module
* MODULES.html.sh (Support for systems lacking POSIX:2008): Add it.
* doc/posix-functions/pthread_sigmask.texi: Document new module.
* lib/signal.in.h (pthread_sigmask): Arrange for replacement.
This is done only as a macro; I don't know how well that'll
work for C++. Move <sys/types.h> include before the include_next,
to avoid mishap on Solaris.
* m4/signal_h.m4 (gl_SIGNAL_H, gl_SIGNAL_H_DEFAULTS): Check for it.
* modules/signal (Makefile.am): Substitute the check's results.
* modules/pthread_sigmask, m4/pthread_sigmask.m4: New files.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 05 Jul 2011 23:44:24 -0700 |
parents | 2a17513766d8 |
children | bb72ef288fbe |
files | ChangeLog MODULES.html.sh doc/posix-functions/pthread_sigmask.texi lib/signal.in.h m4/pthread_sigmask.m4 m4/signal_h.m4 modules/pthread_sigmask modules/signal |
diffstat | 8 files changed, 95 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2011-07-05 Paul Eggert <eggert@cs.ucla.edu> + pthread_sigmask: new module + * MODULES.html.sh (Support for systems lacking POSIX:2008): Add it. + * doc/posix-functions/pthread_sigmask.texi: Document new module. + * lib/signal.in.h (pthread_sigmask): Arrange for replacement. + This is done only as a macro; I don't know how well that'll + work for C++. Move <sys/types.h> include before the include_next, + to avoid mishap on Solaris. + * m4/signal_h.m4 (gl_SIGNAL_H, gl_SIGNAL_H_DEFAULTS): Check for it. + * modules/signal (Makefile.am): Substitute the check's results. + * modules/pthread_sigmask, m4/pthread_sigmask.m4: New files. + test-pselect: new module * modules/pselect-tests, tests/test-pselect.c: New files. * tests/test-select.c, tests/test-sys_select-c++.cc:
--- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -2451,6 +2451,7 @@ func_module times func_module timespec func_module nanosleep + func_module pthread_sigmask func_module regex func_module rename func_module renameat
--- a/doc/posix-functions/pthread_sigmask.texi +++ b/doc/posix-functions/pthread_sigmask.texi @@ -8,11 +8,14 @@ Portability problems fixed by Gnulib: @itemize +@item +This function is missing on some platforms: +Solaris 2.4, mingw, BeOS. @end itemize Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: -Solaris 2.4, mingw, BeOS. +On platforms that do not natively support this function, +it has unspecified behavior in a multi-threaded process. @end itemize
--- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -30,6 +30,12 @@ #ifndef _@GUARD_PREFIX@_SIGNAL_H +/* Define pid_t, uid_t. + Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. + On Solaris 10, <signal.h> includes <sys/types.h>, which eventually includes + us; so include <sys/types.h> now, before the second inclusion guard. */ +#include <sys/types.h> + /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_SIGNAL_H@ @@ -42,10 +48,6 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ -/* Define pid_t, uid_t. - Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */ -#include <sys/types.h> - /* On AIX, sig_atomic_t already includes volatile. C99 requires that 'volatile sig_atomic_t' ignore the extra modifier, but C89 did not. Hence, redefine this to a non-volatile type as needed. */ @@ -100,6 +102,20 @@ #endif +#if @GNULIB_PTHREAD_SIGMASK@ +# if @REPLACE_PTHREAD_SIGMASK@ +# undef pthread_sigmask +# define pthread_sigmask sigprocmask +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_sigmask +# if HAVE_RAW_DECL_PTHREAD_SIGMASK +_GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - " + "use gnulib module pthread_sigmask for portability"); +# endif +#endif + + #if @GNULIB_SIGPROCMASK@ # if !@HAVE_POSIX_SIGNALBLOCKING@
new file mode 100644 --- /dev/null +++ b/m4/pthread_sigmask.m4 @@ -0,0 +1,24 @@ +# pthread_sigmask.m4 serial 1 +dnl Copyright (C) 2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_PTHREAD_SIGMASK], +[ + m4_ifdef([gl_THREADLIB], [ + AC_REQUIRE([gl_THREADLIB]) + if test "$gl_threads_api" = posix; then + gl_save_LIBS="$LIBS" + LIBS="$LIBS $LIBMULTITHREAD" + AC_CHECK_FUNCS([pthread_sigmask]) + LIBS="$gl_save_LIBS" + fi + ], [ + AC_CHECK_FUNCS_ONCE([pthread_sigmask]) + ]) + + if test $ac_cv_func_pthread_sigmask = no; then + REPLACE_PTHREAD_SIGMASK=0 + fi +])
--- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -1,4 +1,4 @@ -# signal_h.m4 serial 12 +# signal_h.m4 serial 13 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -27,7 +27,8 @@ dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <signal.h> - ]], [sigaction sigaddset sigdelset sigemptyset sigfillset sigismember + ]], [pthread_sigmask sigaction + sigaddset sigdelset sigemptyset sigfillset sigismember sigpending sigprocmask]) ]) @@ -42,6 +43,7 @@ AC_DEFUN([gl_SIGNAL_H_DEFAULTS], [ + GNULIB_PTHREAD_SIGMASK=0; AC_SUBST([GNULIB_PTHREAD_SIGMASK]) GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE]) GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK]) GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION]) @@ -55,4 +57,5 @@ HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T]) HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T]) + REPLACE_PTHREAD_SIGMASK=0; AC_SUBST([REPLACE_PTHREAD_SIGMASK]) ])
new file mode 100644 --- /dev/null +++ b/modules/pthread_sigmask @@ -0,0 +1,27 @@ +Description: +POSIX compatible signal blocking for threads. + +Files: +m4/pthread_sigmask.m4 + +Depends-on: +signal +sigprocmask [test $REPLACE_PTHREAD_SIGMASK = 1] + +configure.ac: +gl_PTHREAD_SIGMASK +gl_SYS_SELECT_MODULE_INDICATOR([pthread_sigmask]) + +Makefile.am: + +Include: +<signal.h> + +Link: +$(LIBMULTITHREAD) + +License: +LGPLv2+ + +Maintainer: +Paul Eggert, Bruno Haible, Jim Meyering
--- a/modules/signal +++ b/modules/signal @@ -28,6 +28,7 @@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ + -e 's|@''GNULIB_PTHREAD_SIGMASK''@|$(GNULIB_PTHREAD_SIGMASK)|g' \ -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GNULIB_SIGNAL_H_SIGPIPE)/g' \ -e 's/@''GNULIB_SIGPROCMASK''@/$(GNULIB_SIGPROCMASK)/g' \ -e 's/@''GNULIB_SIGACTION''@/$(GNULIB_SIGACTION)/g' \ @@ -38,6 +39,7 @@ -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \ -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \ -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \ + -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \