Skip to content
Snippets Groups Projects
Commit 04d91569 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Replaced PREEMPTIVE_THREADS with HAVE_YIELDING_SELECT to clarify

the exact nature of the functionality being tested.  -DNO_THREADS
does NOT have a yield select, hence the macro is not defined.
The slapd/daemon code has been changed to test both no threads
and yielding select before using a timeout of NULL.
parent 1eba97fc
No related branches found
No related tags found
No related merge requests found
...@@ -69,9 +69,6 @@ ...@@ -69,9 +69,6 @@
/* define if you have PP */ /* define if you have PP */
#undef HAVE_PP #undef HAVE_PP
/* define if you have a preemptive POSIX Threads implementation */
#undef HAVE_PREEMPTIVE_PTHREADS
/* define if you have POSIX Threads */ /* define if you have POSIX Threads */
#undef HAVE_PTHREADS #undef HAVE_PTHREADS
...@@ -105,6 +102,9 @@ ...@@ -105,6 +102,9 @@
/* define if you have XTPP */ /* define if you have XTPP */
#undef HAVE_XTPP #undef HAVE_XTPP
/* define this if select() implicitly yields in thread environments */
#undef HAVE_YIELDING_SELECT
/* define this for connectionless LDAP support */ /* define this for connectionless LDAP support */
#undef LDAP_CONNECTIONLESS #undef LDAP_CONNECTIONLESS
...@@ -147,9 +147,6 @@ ...@@ -147,9 +147,6 @@
/* define this if you want no thread support */ /* define this if you want no thread support */
#undef NO_THREADS #undef NO_THREADS
/* define this if the thread package is preemptive */
#undef PREEMPTIVE_THREADS
/* define this for ACL Group support */ /* define this for ACL Group support */
#undef SLAPD_ACLGROUPS #undef SLAPD_ACLGROUPS
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ OL_ARG_WITH(kerberos,[ --with-kerberos use Kerberos], ...@@ -42,7 +42,7 @@ OL_ARG_WITH(kerberos,[ --with-kerberos use Kerberos],
auto, [auto k5 k4 afs yes no]) auto, [auto k5 k4 afs yes no])
OL_ARG_WITH(threads,[ --with-threads use threads], OL_ARG_WITH(threads,[ --with-threads use threads],
auto, [auto posix mach lwp yes no manual] ) auto, [auto posix mach lwp yes no manual] )
OL_ARG_WITH(preemptive,[ --with-preemptive thread implementation is preemptive], OL_ARG_WITH(yielding_select,[ --with-yielding-select with implicitly yielding select],
auto, [auto yes no manual] ) auto, [auto yes no manual] )
dnl Server options dnl Server options
...@@ -415,8 +415,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then ...@@ -415,8 +415,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then
AC_CHECK_LIB(pthread, pthread_join, [ AC_CHECK_LIB(pthread, pthread_join, [
ol_link_threads=posix ol_link_threads=posix
LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lexc" LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lexc"
if test $ol_with_preemptive = auto ; then if test $ol_with_yielding_select = auto ; then
ol_with_preemptive=yes ol_with_yielding_select=yes
fi fi
],,[-lexc]) ],,[-lexc])
LIBS="$save_LIBS" LIBS="$save_LIBS"
...@@ -428,8 +428,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then ...@@ -428,8 +428,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then
AC_CHECK_LIB(pthreads, pthread_join, [ AC_CHECK_LIB(pthreads, pthread_join, [
ol_link_threads=posix ol_link_threads=posix
LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc -lc_r" LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc -lc_r"
if test $ol_with_preemptive = auto ; then if test $ol_with_yielding_select = auto ; then
ol_with_preemptive=yes ol_with_yielding_select=yes
fi fi
],,[-lmach -lexc -lc_r]) ],,[-lmach -lexc -lc_r])
LIBS="$save_LIBS" LIBS="$save_LIBS"
...@@ -504,9 +504,9 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then ...@@ -504,9 +504,9 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then
thr_setconcurrency \ thr_setconcurrency \
) )
dnl Check PREEMPTIVE Implementation dnl Check if select causes an yield
if test $ol_with_preemptive = auto ; then if test $ol_with_yielding_select = auto ; then
AC_MSG_CHECKING([for preemptive Pthread implementation]) AC_MSG_CHECKING([if select yields])
AC_TRY_RUN([ AC_TRY_RUN([
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
...@@ -560,13 +560,12 @@ int argc; char **argv; ...@@ -560,13 +560,12 @@ int argc; char **argv;
#endif #endif
exit(0); exit(0);
} }
], [ol_pthread_preemptive=yes], [ol_pthread_preemptive=no], [ ], [ol_pthread_select_yields=yes], [ol_pthread_select_yields=no], [
AC_MSG_ERROR([crossing compiling: use --with-preemptive=yes|no|manual])]) AC_MSG_ERROR([crossing compiling: use --with-yielding_select=yes|no|manual])])
AC_MSG_RESULT($ol_pthread_preemptive) AC_MSG_RESULT($ol_pthread_select_yields)
if test $ol_pthread_preemptive = yes ; then if test $ol_pthread_select_yields = yes ; then
AC_DEFINE(HAVE_PREEMPTIVE_PTHREADS) ol_with_yielding_select=yes
ol_with_preemptive=yes
fi fi
fi fi
...@@ -648,8 +647,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = lwp ; then ...@@ -648,8 +647,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = lwp ; then
LTHREAD_LIBS="$LTHREAD_LIBS -lthread" LTHREAD_LIBS="$LTHREAD_LIBS -lthread"
ol_link_threads=thr ol_link_threads=thr
if test $ol_with_preemptive = auto ; then if test $ol_with_yielding_select = auto ; then
ol_with_preemptive=yes ol_with_yielding_select=yes
fi fi
fi fi
fi fi
...@@ -664,15 +663,15 @@ if test $ol_with_threads = auto -o $ol_with_threads = lwp ; then ...@@ -664,15 +663,15 @@ if test $ol_with_threads = auto -o $ol_with_threads = lwp ; then
LTHREAD_LIBS="$LTHREAD_LIBS -llwp" LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
ol_link_threads=lwp ol_link_threads=lwp
if test $ol_with_preemptive = auto ; then if test $ol_with_yielding_select = auto ; then
ol_with_preemptive=no ol_with_yielding_select=no
fi fi
fi fi
fi fi
fi fi
if test $ol_with_preemptive = yes ; then if test $ol_with_yielding_select = yes ; then
AC_DEFINE(PREEMPTIVE_THREADS,1) AC_DEFINE(HAVE_YIELDING_SELECT,1)
fi fi
if test $ol_with_threads = manual ; then if test $ol_with_threads = manual ; then
...@@ -731,7 +730,6 @@ if test $ol_link_threads = no ; then ...@@ -731,7 +730,6 @@ if test $ol_link_threads = no ; then
fi fi
AC_DEFINE(NO_THREADS,1) AC_DEFINE(NO_THREADS,1)
AC_DEFINE(PREEMPTIVE_THREADS,1)
LTHREAD_LIBS="" LTHREAD_LIBS=""
fi fi
......
...@@ -200,11 +200,6 @@ LDAP_BEGIN_DECL ...@@ -200,11 +200,6 @@ LDAP_BEGIN_DECL
#define NO_THREADS 1 #define NO_THREADS 1
#endif #endif
#ifndef PREEMPTIVE_THREADS
/* treat no threads as preemptive */
#define PREEMPTIVE_THREADS 1
#endif
typedef void *(*VFP)(); typedef void *(*VFP)();
/* thread attributes and thread type */ /* thread attributes and thread type */
......
...@@ -189,7 +189,7 @@ slapd_daemon( ...@@ -189,7 +189,7 @@ slapd_daemon(
Debug( LDAP_DEBUG_CONNS, "before select active_threads %d\n", Debug( LDAP_DEBUG_CONNS, "before select active_threads %d\n",
active_threads, 0, 0 ); active_threads, 0, 0 );
#ifdef PREEMPTIVE_THREADS #if defined( HAVE_YIELDING_SELECT ) || defined( NO_THREADS )
tvp = NULL; tvp = NULL;
#else #else
tvp = active_threads ? &zero : NULL; tvp = active_threads ? &zero : NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment