]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap_r/thr_posix.c
Add valx arg to config_parse_add - indicate which value in the current
[openldap] / libraries / libldap_r / thr_posix.c
index cb964d982d4db72329132b0c1a36d4297608a8de..ce48b32b53000e919b28449f138745bb055e6422 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2006 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 
 #include <ac/errno.h>
 
+#ifdef REPLACE_BROKEN_YIELD
+#ifndef HAVE_NANOSLEEP
+#include <ac/socket.h>
+#endif
+#include <ac/time.h>
+#endif
+
 #include "ldap_pvt_thread.h" /* Get the thread interface */
 #define LDAP_THREAD_IMPLEMENTATION
 #define LDAP_THREAD_RDWR_IMPLEMENTATION
@@ -207,8 +214,18 @@ ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
 int 
 ldap_pvt_thread_yield( void )
 {
-#if HAVE_THR_YIELD
-       return thr_yield();
+#ifdef REPLACE_BROKEN_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
+       thr_yield();
+       return 0;
 
 #elif HAVE_PTHREADS == 10
        return sched_yield();