summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-09-10 14:10:54 (GMT)
committerGuido van Rossum <guido@python.org>2001-09-10 14:10:54 (GMT)
commitd0b69eceb446ac7176f96c3849c6997ec4ce134f (patch)
tree4359c27de8896645e053c1d673a5829a0f05f7cc /configure.in
parent47f40343b304cbd92dec796cdb2b647743a95c01 (diff)
downloadcpython-d0b69eceb446ac7176f96c3849c6997ec4ce134f.zip
cpython-d0b69eceb446ac7176f96c3849c6997ec4ce134f.tar.gz
cpython-d0b69eceb446ac7176f96c3849c6997ec4ce134f.tar.bz2
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.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in35
1 files changed, 33 insertions, 2 deletions
diff --git a/configure.in b/configure.in
index 8f4b0b9..7ade904 100644
--- a/configure.in
+++ b/configure.in
@@ -903,6 +903,7 @@ then
CC="$CC -Kpthread"
AC_DEFINE(WITH_THREAD)
AC_DEFINE(_POSIX_THREADS)
+ posix_threads=yes
LIBOBJS="$LIBOBJS thread.o"
else
if test ! -z "$with_threads" -a -d "$with_threads"
@@ -927,14 +928,18 @@ else
AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
case $ac_sys_system in
Darwin*) ;;
- *) AC_DEFINE(_POSIX_THREADS);;
+ *) AC_DEFINE(_POSIX_THREADS)
+ posix_threads=yes
+ ;;
esac
LIBS="-lpthread $LIBS"
LIBOBJS="$LIBOBJS thread.o"],[
AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
case $ac_sys_system in
Darwin*) ;;
- *) AC_DEFINE(_POSIX_THREADS);;
+ *) AC_DEFINE(_POSIX_THREADS)
+ posix_threads=yes
+ ;;
esac
LIBOBJS="$LIBOBJS thread.o"],[
AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
@@ -942,27 +947,53 @@ else
LIBOBJS="$LIBOBJS thread.o"],[
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)
LIBS="$LIBS -lmpc"
LIBOBJS="$LIBOBJS thread.o"