]> git.sur5r.net Git - openldap/commitdiff
ITS#3950 use select instead of yield when select does the right thing.
authorHoward Chu <hyc@openldap.org>
Fri, 6 Jan 2006 01:02:00 +0000 (01:02 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 6 Jan 2006 01:02:00 +0000 (01:02 +0000)
libraries/libldap_r/thr_posix.c

index 2a05236399b3df2c4a324dcb243abf778c94b9fa..a80f69f8e5782b4dd45f41cb060d7d0b2c56f627 100644 (file)
 
 #include <ac/errno.h>
 
+#if defined( HAVE_YIELDING_SELECT )
+#include <ac/socket.h>
+#include <ac/time.h>
+#endif
+
 #include "ldap_pvt_thread.h" /* Get the thread interface */
 #define LDAP_THREAD_IMPLEMENTATION
 #define LDAP_THREAD_RDWR_IMPLEMENTATION
@@ -207,7 +212,11 @@ ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
 int 
 ldap_pvt_thread_yield( void )
 {
-#if HAVE_THR_YIELD
+#if HAVE_YIELDING_SELECT
+       struct timeval tv = {0,0};
+       select( 0, NULL, NULL, NULL, &tv );
+       return 0;
+#elif HAVE_THR_YIELD
        return thr_yield();
 
 #elif HAVE_PTHREADS == 10