]> git.sur5r.net Git - openldap/commitdiff
Make use of nanosleep/select as a sched_yeild(2) replacement
authorKurt Zeilenga <kurt@openldap.org>
Fri, 6 Jan 2006 05:22:35 +0000 (05:22 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 6 Jan 2006 05:22:35 +0000 (05:22 +0000)
conditional on REPLACE_SCHED_YEILD.   Configure support
needed.

libraries/libldap_r/thr_posix.c

index a80f69f8e5782b4dd45f41cb060d7d0b2c56f627..6d399e9c16ebf7c2c410e7ddb9cb61c1704ff135 100644 (file)
 
 #include <ac/errno.h>
 
-#if defined( HAVE_YIELDING_SELECT )
+#if REPLACE_SCHED_YIELD
+#ifndef HAVE_NANOSLEEP
 #include <ac/socket.h>
+#endif
 #include <ac/time.h>
 #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();