]> git.sur5r.net Git - openldap/commitdiff
Prefer thr_yield over sched_yield for Solaris
authorHoward Chu <hyc@openldap.org>
Sat, 12 Oct 2002 01:21:21 +0000 (01:21 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 12 Oct 2002 01:21:21 +0000 (01:21 +0000)
configure.in
libraries/libldap_r/thr_posix.c

index 7743bebee44ce6c319c5b64b4dd77c78d67d2b69..0ec757fdc4496a1508a44f6d0ab0dce52c235b1e 100644 (file)
@@ -1484,11 +1484,12 @@ dnl                     [ol_cv_pthread_lpthread_lexc])
 
                        dnl All POSIX Thread (final) implementations should have
                        dnl sched_yield instead of pthread yield.
-                       dnl check for both
-                       AC_CHECK_FUNCS(sched_yield pthread_yield)
+                       dnl check for both, and thr_yield for Solaris
+                       AC_CHECK_FUNCS(sched_yield pthread_yield thr_yield)
 
                        if test $ac_cv_func_sched_yield = no -a \
-                               $ac_cv_func_pthread_yield = no ; then
+                               $ac_cv_func_pthread_yield = no -a \
+                               $ac_cv_func_thr_yield = no ; then
                                dnl Digital UNIX has sched_yield() in -lrt
                                AC_CHECK_LIB(rt, sched_yield,
                                        [LTHREAD_LIBS="$LTHREAD_LIBS -lrt"
@@ -1497,12 +1498,6 @@ dnl                      [ol_cv_pthread_lpthread_lexc])
                                        ac_cv_func_sched_yield=yes],
                                        [ac_cv_func_sched_yield=no])
                        fi
-                       if test $ac_cv_func_sched_yield = no -a \
-                               $ac_cv_func_pthread_yield = no ; then
-                               dnl Solaris has sched_yield() stub in -lposix4
-                               dnl but we'll use thr_yield instead.
-                               AC_CHECK_FUNCS(thr_yield)
-                       fi
                        if test $ac_cv_func_sched_yield = no -a \
                                $ac_cv_func_pthread_yield = no -a \
                                "$ac_cv_func_thr_yield" = no ; then
index dfeb48f63f09266b68899f36bc30930b733390a5..5ddc03a871f5393b6061076a4cd17e3ea9c55873 100644 (file)
@@ -179,16 +179,16 @@ ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
 int 
 ldap_pvt_thread_yield( void )
 {
-#if HAVE_PTHREADS == 10
+#if HAVE_THR_YIELD
+       return thr_yield();
+
+#elif HAVE_PTHREADS == 10
        return sched_yield();
 
 #elif defined(_POSIX_THREAD_IS_GNU_PTH)
        sched_yield();
        return 0;
 
-#elif HAVE_THR_YIELD
-       return thr_yield();
-
 #elif HAVE_PTHREADS == 6
        pthread_yield(NULL);
        return 0;