[Python-checkins] CVS: python/dist/src acconfig.h,1.55,1.56 configure,1.248,1.249 configure.in,1.256,1.257 pyconfig.h.in,1.10,1.11
Guido van Rossum
gvanrossum@users.sourceforge.net
Mon, 10 Sep 2001 07:10:56 -0700
Update of /cvsroot/python/python/dist/src
In directory usw-pr-cvs1:/tmp/cvs-serv4323
Modified Files:
acconfig.h configure configure.in pyconfig.h.in
Log Message:
Improve threading on Solaris, according to SF patch #460269, submitted
by bbrox@bbrox.org / lionel.ulmer@free.fr.
This adds a configure check and if all goes well turns on the
PTHREAD_SCOPE_SYSTEM thread attribute for new threads.
This should remove the need to add tiny sleeps at the start of threads
to allow other threads to be scheduled.
Index: acconfig.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/acconfig.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** acconfig.h 2001/09/09 23:51:39 1.55
--- acconfig.h 2001/09/10 14:10:53 1.56
***************
*** 156,159 ****
--- 156,162 ----
#undef SIZEOF_PTHREAD_T
+ /* Defined if PTHREAD_SCOPE_SYSTEM supported. */
+ #undef PTHREAD_SYSTEM_SCHED_SUPPORTED
+
/* sizeof(void *) */
#undef SIZEOF_VOID_P
Index: configure
===================================================================
RCS file: /cvsroot/python/python/dist/src/configure,v
retrieving revision 1.248
retrieving revision 1.249
diff -C2 -d -r1.248 -r1.249
*** configure 2001/09/09 23:51:39 1.248
--- configure 2001/09/10 14:10:53 1.249
***************
*** 1,5 ****
#! /bin/sh
! # From configure.in Revision: 1.255
# Guess values for system-dependent variables and create Makefiles.
--- 1,5 ----
#! /bin/sh
! # From configure.in Revision: 1.257
[...2715 lines suppressed...]
if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
! #line 7127 "configure"
#include "confdefs.h"
#include <sys/types.h>
***************
*** 7115,7119 ****
SRCDIRS="Parser Grammar Objects Python Modules"
echo $ac_n "checking for build directories""... $ac_c" 1>&6
! echo "configure:7118: checking for build directories" >&5
for dir in $SRCDIRS; do
if test ! -d $dir; then
--- 7173,7177 ----
SRCDIRS="Parser Grammar Objects Python Modules"
echo $ac_n "checking for build directories""... $ac_c" 1>&6
! echo "configure:7176: checking for build directories" >&5
for dir in $SRCDIRS; do
if test ! -d $dir; then
Index: configure.in
===================================================================
RCS file: /cvsroot/python/python/dist/src/configure.in,v
retrieving revision 1.256
retrieving revision 1.257
diff -C2 -d -r1.256 -r1.257
*** configure.in 2001/09/09 23:51:39 1.256
--- configure.in 2001/09/10 14:10:54 1.257
***************
*** 904,907 ****
--- 904,908 ----
AC_DEFINE(WITH_THREAD)
AC_DEFINE(_POSIX_THREADS)
+ posix_threads=yes
LIBOBJS="$LIBOBJS thread.o"
else
***************
*** 928,932 ****
case $ac_sys_system in
Darwin*) ;;
! *) AC_DEFINE(_POSIX_THREADS);;
esac
LIBS="-lpthread $LIBS"
--- 929,935 ----
case $ac_sys_system in
Darwin*) ;;
! *) AC_DEFINE(_POSIX_THREADS)
! posix_threads=yes
! ;;
esac
LIBS="-lpthread $LIBS"
***************
*** 935,939 ****
case $ac_sys_system in
Darwin*) ;;
! *) AC_DEFINE(_POSIX_THREADS);;
esac
LIBOBJS="$LIBOBJS thread.o"],[
--- 938,944 ----
case $ac_sys_system in
Darwin*) ;;
! *) AC_DEFINE(_POSIX_THREADS)
! posix_threads=yes
! ;;
esac
LIBOBJS="$LIBOBJS thread.o"],[
***************
*** 943,966 ****
--- 948,997 ----
AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
AC_DEFINE(_POSIX_THREADS)
+ posix_threads=yes
LIBS="$LIBS -lpthreads"
LIBOBJS="$LIBOBJS thread.o"], [
AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
AC_DEFINE(_POSIX_THREADS)
+ posix_threads=yes
LIBS="$LIBS -lc_r"
LIBOBJS="$LIBOBJS thread.o"], [
AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
AC_DEFINE(_POSIX_THREADS)
+ posix_threads=yes
LIBS="$LIBS -lthread"
LIBOBJS="$LIBOBJS thread.o"], [
AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
AC_DEFINE(_POSIX_THREADS)
+ posix_threads=yes
LIBS="$LIBS -lpthread"
LIBOBJS="$LIBOBJS thread.o"], [
AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
AC_DEFINE(_POSIX_THREADS)
+ posix_threads=yes
LIBS="$LIBS -lcma"
LIBOBJS="$LIBOBJS thread.o"],[
USE_THREAD_MODULE="#"])
])])])])])])])])])
+
+ if test "$posix_threads" = "yes"; then
+ AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
+ AC_CACHE_VAL(ac_cv_pthread_system_supported,
+ [AC_TRY_RUN([#include <pthread.h>
+ void *foo(void *parm) {
+ return NULL;
+ }
+ main() {
+ pthread_attr_t attr;
+ if (pthread_attr_init(&attr)) exit(-1);
+ if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
+ if (pthread_create(NULL, &attr, foo, NULL)) exit(-1);
+ exit(0);
+ }], ac_cv_pthread_system_supported=yes, ac_cv_pthread_system_supported=no)
+ ])
+ AC_MSG_RESULT($ac_cv_pthread_system_supported)
+ if test "$ac_cv_pthread_system_supported" = "yes"; then
+ AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED)
+ fi
+ fi
AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Index: pyconfig.h.in
===================================================================
RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** pyconfig.h.in 2001/09/09 23:51:39 1.10
--- pyconfig.h.in 2001/09/10 14:10:54 1.11
***************
*** 215,218 ****
--- 215,221 ----
#undef SIZEOF_PTHREAD_T
+ /* Defined if PTHREAD_SCOPE_SYSTEM supported. */
+ #undef PTHREAD_SYSTEM_SCHED_SUPPORTED
+
/* Define to `int' if <sys/types.h> doesn't define. */
#undef socklen_t