From 21d15546d32bc430804adf2011cc342031c5e3d2 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 6 Jan 2006 05:22:35 +0000 Subject: [PATCH] Make use of nanosleep/select as a sched_yeild(2) replacement conditional on REPLACE_SCHED_YEILD. Configure support needed. --- libraries/libldap_r/thr_posix.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/libldap_r/thr_posix.c b/libraries/libldap_r/thr_posix.c index a80f69f8e5..6d399e9c16 100644 --- a/libraries/libldap_r/thr_posix.c +++ b/libraries/libldap_r/thr_posix.c @@ -20,8 +20,10 @@ #include -#if defined( HAVE_YIELDING_SELECT ) +#if REPLACE_SCHED_YIELD +#ifndef HAVE_NANOSLEEP #include +#endif #include #endif @@ -212,9 +214,14 @@ ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo ) int ldap_pvt_thread_yield( void ) { -#if HAVE_YIELDING_SELECT +#ifdef REPLACE_SCHED_YIELD +#ifdef HAVE_NANOSLEEP + struct timespec t = { 0, 0 }; + nanosleep(&t, NULL); +#else struct timeval tv = {0,0}; select( 0, NULL, NULL, NULL, &tv ); +#endif return 0; #elif HAVE_THR_YIELD return thr_yield(); -- 2.39.5