From: Kurt Zeilenga Date: Fri, 6 Jan 2006 05:22:35 +0000 (+0000) Subject: Make use of nanosleep/select as a sched_yeild(2) replacement X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~452 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=21d15546d32bc430804adf2011cc342031c5e3d2;p=openldap Make use of nanosleep/select as a sched_yeild(2) replacement conditional on REPLACE_SCHED_YEILD. Configure support needed. --- 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();