mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Do not define _POSIX_THREADS if unistd.h defines it.
Check for pthread_sigmask before using it. Fixes remaining problem in #470781.
This commit is contained in:
parent
c0f1bfec05
commit
69c0ff3836
4 changed files with 336 additions and 289 deletions
|
@ -75,7 +75,7 @@
|
||||||
* other UNIX International compliant systems that don't have the full
|
* other UNIX International compliant systems that don't have the full
|
||||||
* pthread implementation.
|
* pthread implementation.
|
||||||
*/
|
*/
|
||||||
#ifdef PY_PTHREAD_STD
|
#ifdef HAVE_PTHREAD_SIGMASK
|
||||||
# define SET_THREAD_SIGMASK pthread_sigmask
|
# define SET_THREAD_SIGMASK pthread_sigmask
|
||||||
#else
|
#else
|
||||||
# define SET_THREAD_SIGMASK sigprocmask
|
# define SET_THREAD_SIGMASK sigprocmask
|
||||||
|
|
34
configure.in
34
configure.in
|
@ -968,7 +968,6 @@ then
|
||||||
elif test "$ac_cv_pthread_is_default" = yes
|
elif test "$ac_cv_pthread_is_default" = yes
|
||||||
then
|
then
|
||||||
AC_DEFINE(WITH_THREAD)
|
AC_DEFINE(WITH_THREAD)
|
||||||
AC_DEFINE(_POSIX_THREADS)
|
|
||||||
# Defining _REENTRANT on system with POSIX threads should not hurt.
|
# Defining _REENTRANT on system with POSIX threads should not hurt.
|
||||||
AC_DEFINE(_REENTRANT)
|
AC_DEFINE(_REENTRANT)
|
||||||
posix_threads=yes
|
posix_threads=yes
|
||||||
|
@ -977,7 +976,6 @@ elif test "$ac_cv_kpthread" = "yes"
|
||||||
then
|
then
|
||||||
CC="$CC -Kpthread"
|
CC="$CC -Kpthread"
|
||||||
AC_DEFINE(WITH_THREAD)
|
AC_DEFINE(WITH_THREAD)
|
||||||
AC_DEFINE(_POSIX_THREADS)
|
|
||||||
posix_threads=yes
|
posix_threads=yes
|
||||||
LIBOBJS="$LIBOBJS thread.o"
|
LIBOBJS="$LIBOBJS thread.o"
|
||||||
else
|
else
|
||||||
|
@ -987,6 +985,18 @@ else
|
||||||
if test ! -z "$withval" -a -d "$withval"
|
if test ! -z "$withval" -a -d "$withval"
|
||||||
then LDFLAGS="$LDFLAGS -L$withval"
|
then LDFLAGS="$LDFLAGS -L$withval"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# According to the POSIX spec, a pthreads implementation must
|
||||||
|
# define _POSIX_THREADS in unistd.h. Some apparently don't (which ones?)
|
||||||
|
AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
|
||||||
|
AC_EGREP_CPP(yes,
|
||||||
|
[#include <unistd.h>
|
||||||
|
#ifdef _POSIX_THREADS
|
||||||
|
yes
|
||||||
|
#endif
|
||||||
|
], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
|
||||||
|
AC_MSG_RESULT($unistd_defines_pthreads)
|
||||||
|
|
||||||
AC_DEFINE(_REENTRANT)
|
AC_DEFINE(_REENTRANT)
|
||||||
AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
|
AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
|
||||||
AC_DEFINE(C_THREADS)
|
AC_DEFINE(C_THREADS)
|
||||||
|
@ -1013,47 +1023,32 @@ void * start_routine (void *arg) { exit (0); }], [
|
||||||
pthread_create (NULL, NULL, start_routine, NULL)], [
|
pthread_create (NULL, NULL, start_routine, NULL)], [
|
||||||
AC_MSG_RESULT(yes)
|
AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE(WITH_THREAD)
|
AC_DEFINE(WITH_THREAD)
|
||||||
case $ac_sys_system in
|
|
||||||
Darwin*) ;;
|
|
||||||
*) AC_DEFINE(_POSIX_THREADS)
|
|
||||||
posix_threads=yes
|
posix_threads=yes
|
||||||
;;
|
|
||||||
esac
|
|
||||||
LIBOBJS="$LIBOBJS thread.o"],[
|
LIBOBJS="$LIBOBJS thread.o"],[
|
||||||
LIBS=$_libs
|
LIBS=$_libs
|
||||||
AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
|
AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
|
||||||
case $ac_sys_system in
|
|
||||||
Darwin*) ;;
|
|
||||||
*) AC_DEFINE(_POSIX_THREADS)
|
|
||||||
posix_threads=yes
|
posix_threads=yes
|
||||||
;;
|
|
||||||
esac
|
|
||||||
LIBOBJS="$LIBOBJS thread.o"],[
|
LIBOBJS="$LIBOBJS thread.o"],[
|
||||||
AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
|
AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
|
||||||
AC_DEFINE(BEOS_THREADS)
|
AC_DEFINE(BEOS_THREADS)
|
||||||
LIBOBJS="$LIBOBJS thread.o"],[
|
LIBOBJS="$LIBOBJS thread.o"],[
|
||||||
AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
|
AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
|
||||||
AC_DEFINE(_POSIX_THREADS)
|
|
||||||
posix_threads=yes
|
posix_threads=yes
|
||||||
LIBS="$LIBS -lpthreads"
|
LIBS="$LIBS -lpthreads"
|
||||||
LIBOBJS="$LIBOBJS thread.o"], [
|
LIBOBJS="$LIBOBJS thread.o"], [
|
||||||
AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
|
AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
|
||||||
AC_DEFINE(_POSIX_THREADS)
|
|
||||||
posix_threads=yes
|
posix_threads=yes
|
||||||
LIBS="$LIBS -lc_r"
|
LIBS="$LIBS -lc_r"
|
||||||
LIBOBJS="$LIBOBJS thread.o"], [
|
LIBOBJS="$LIBOBJS thread.o"], [
|
||||||
AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
|
AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
|
||||||
AC_DEFINE(_POSIX_THREADS)
|
|
||||||
posix_threads=yes
|
posix_threads=yes
|
||||||
LIBS="$LIBS -lthread"
|
LIBS="$LIBS -lthread"
|
||||||
LIBOBJS="$LIBOBJS thread.o"], [
|
LIBOBJS="$LIBOBJS thread.o"], [
|
||||||
AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
|
AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
|
||||||
AC_DEFINE(_POSIX_THREADS)
|
|
||||||
posix_threads=yes
|
posix_threads=yes
|
||||||
LIBS="$LIBS -lpthread"
|
LIBS="$LIBS -lpthread"
|
||||||
LIBOBJS="$LIBOBJS thread.o"], [
|
LIBOBJS="$LIBOBJS thread.o"], [
|
||||||
AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
|
AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
|
||||||
AC_DEFINE(_POSIX_THREADS)
|
|
||||||
posix_threads=yes
|
posix_threads=yes
|
||||||
LIBS="$LIBS -lcma"
|
LIBS="$LIBS -lcma"
|
||||||
LIBOBJS="$LIBOBJS thread.o"],[
|
LIBOBJS="$LIBOBJS thread.o"],[
|
||||||
|
@ -1061,6 +1056,10 @@ pthread_create (NULL, NULL, start_routine, NULL)], [
|
||||||
])])])])])])])])])
|
])])])])])])])])])
|
||||||
|
|
||||||
if test "$posix_threads" = "yes"; then
|
if test "$posix_threads" = "yes"; then
|
||||||
|
if test "$unistd_defines_pthreads" = "no"; then
|
||||||
|
AC_DEFINE(_POSIX_THREADS)
|
||||||
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
|
AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
|
||||||
AC_CACHE_VAL(ac_cv_pthread_system_supported,
|
AC_CACHE_VAL(ac_cv_pthread_system_supported,
|
||||||
[AC_TRY_RUN([#include <pthread.h>
|
[AC_TRY_RUN([#include <pthread.h>
|
||||||
|
@ -1082,6 +1081,7 @@ pthread_create (NULL, NULL, start_routine, NULL)], [
|
||||||
if test "$ac_cv_pthread_system_supported" = "yes"; then
|
if test "$ac_cv_pthread_system_supported" = "yes"; then
|
||||||
AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED)
|
AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED)
|
||||||
fi
|
fi
|
||||||
|
AC_CHECK_FUNCS(pthread_sigmask)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
|
AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
|
||||||
|
|
|
@ -477,6 +477,9 @@
|
||||||
/* Define if you have the pthread_init function. */
|
/* Define if you have the pthread_init function. */
|
||||||
#undef HAVE_PTHREAD_INIT
|
#undef HAVE_PTHREAD_INIT
|
||||||
|
|
||||||
|
/* Define if you have the pthread_sigmask function. */
|
||||||
|
#undef HAVE_PTHREAD_SIGMASK
|
||||||
|
|
||||||
/* Define if you have the putenv function. */
|
/* Define if you have the putenv function. */
|
||||||
#undef HAVE_PUTENV
|
#undef HAVE_PUTENV
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue