[Python-checkins] CVS: python/dist/src acconfig.h,1.46.2.2,1.46.2.3 config.h.in,2.91.2.5,2.91.2.6 configure,1.207.2.5,1.207.2.6 configure.in,1.215.2.5,1.215.2.6

Anthony Baxter anthonybaxter@users.sourceforge.net
Sat, 22 Dec 2001 20:07:30 -0800


Update of /cvsroot/python/python/dist/src
In directory usw-pr-cvs1:/tmp/cvs-serv16386

Modified Files:
      Tag: release21-maint
	acconfig.h config.h.in configure configure.in 
Log Message:
backport of solaris thread patch, adding PTHREAD_SCOPE_SYSTEM support:

  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.

This is a semi-feature, but makes such a huge difference to the
performance of Zope on Solaris that it's worthwhile (well, imho).



Index: acconfig.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/acconfig.h,v
retrieving revision 1.46.2.2
retrieving revision 1.46.2.3
diff -C2 -d -r1.46.2.2 -r1.46.2.3
*** acconfig.h	2001/07/11 22:27:39	1.46.2.2
--- acconfig.h	2001/12/23 04:07:22	1.46.2.3
***************
*** 131,134 ****
--- 131,137 ----
  #undef SIZEOF_PTHREAD_T
  
+ /* Defined if PTHREAD_SCOPE_SYSTEM supported. */
+ #undef PTHREAD_SYSTEM_SCHED_SUPPORTED
+ 
  /* sizeof(void *) */
  #undef SIZEOF_VOID_P

Index: config.h.in
===================================================================
RCS file: /cvsroot/python/python/dist/src/Attic/config.h.in,v
retrieving revision 2.91.2.5
retrieving revision 2.91.2.6
diff -C2 -d -r2.91.2.5 -r2.91.2.6
*** config.h.in	2001/07/16 16:07:26	2.91.2.5
--- config.h.in	2001/12/23 04:07:22	2.91.2.6
***************
*** 1,3 ****
! /* config.h.in.  Generated automatically from configure.in by autoheader 2.13.  */
  
  /* Define if on AIX 3.
--- 1,3 ----
! /* config.h.in.  Generated automatically from configure.in by autoheader.  */
  
  /* Define if on AIX 3.
***************
*** 189,192 ****
--- 189,195 ----
  /* The number of bytes in a pthread_t. */
  #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.  */

Index: configure
===================================================================
RCS file: /cvsroot/python/python/dist/src/configure,v
retrieving revision 1.207.2.5
retrieving revision 1.207.2.6
diff -C2 -d -r1.207.2.5 -r1.207.2.6
*** configure	2001/07/16 16:07:26	1.207.2.5
--- configure	2001/12/23 04:07:22	1.207.2.6
***************
*** 1,5 ****
  #! /bin/sh
  
! # From configure.in Revision: 1.215.2.4 
  
  # Guess values for system-dependent variables and create Makefiles.
--- 1,5 ----
  #! /bin/sh
  
! # From configure.in Revision: 1.215.2.5 
  
[...3328 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 6323 "configure"
  #include "confdefs.h"
  #include <sys/types.h>
***************
*** 6323,6327 ****
  SRCDIRS="Parser Grammar Objects Python Modules"
  echo $ac_n "checking for build directories""... $ac_c" 1>&6
! echo "configure:6326: checking for build directories" >&5
  for dir in $SRCDIRS; do
      if test ! -d $dir; then
--- 6369,6373 ----
  SRCDIRS="Parser Grammar Objects Python Modules"
  echo $ac_n "checking for build directories""... $ac_c" 1>&6
! echo "configure:6372: 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.215.2.5
retrieving revision 1.215.2.6
diff -C2 -d -r1.215.2.5 -r1.215.2.6
*** configure.in	2001/07/16 16:07:26	1.215.2.5
--- configure.in	2001/12/23 04:07:25	1.215.2.6
***************
*** 820,823 ****
--- 820,824 ----
  	AC_DEFINE(WITH_THREAD)
  	AC_DEFINE(_POSIX_THREADS)
+ 	posix_threads=yes
  	USE_THREAD_MODULE=""
      else
***************
*** 843,846 ****
--- 844,848 ----
  	AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
  	AC_DEFINE(_POSIX_THREADS)
+ 	posix_threads=yes
  	LIBS="-lpthread $LIBS"
  	LIBOBJS="$LIBOBJS thread.o"],[
***************
*** 848,852 ****
  	case $ac_sys_system in
  	  Darwin*) ;;
! 	  *) AC_DEFINE(_POSIX_THREADS);;
  	esac
  	LIBOBJS="$LIBOBJS thread.o"],[
--- 850,856 ----
  	case $ac_sys_system in
  	  Darwin*) ;;
! 	  *) AC_DEFINE(_POSIX_THREADS)
! 	     posix_threads=yes
!              ;;
  	esac
  	LIBOBJS="$LIBOBJS thread.o"],[
***************
*** 856,879 ****
--- 860,908 ----
  	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)