Commit b7aa4d66 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Updated yield handling

parent cbc8b6bc
This diff is collapsed.
......@@ -1467,11 +1467,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"
......@@ -1480,12 +1481,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
......@@ -1612,12 +1607,13 @@ int main(argc, argv)
pthread_create(&t, NULL, task, NULL);
#endif
#if HAVE_SCHED_YIELD
sched_yield(); /* make sure task runs first */
#else
#ifdef HAVE_PTHREAD_YIELD
pthread_yield(); /* make sure task runs first */
#endif
/* make sure task runs first */
#if HAVE_THR_YIELD
thr_yield();
#elif defined( HAVE_SCHED_YIELD )
sched_yield();
#elif defined( HAVE_PTHREAD_YIELD )
pthread_yield();
#endif
exit(2);
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment