]> git.sur5r.net Git - openldap/commitdiff
More for prev commit
authorHoward Chu <hyc@openldap.org>
Sun, 25 Jan 2009 03:04:43 +0000 (03:04 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 25 Jan 2009 03:04:43 +0000 (03:04 +0000)
servers/slapd/result.c

index 22cfde86886e14c67b07492f72dc34eda0d95b20..3ec5021db539279774a837ce6fcf2073c4f27174 100644 (file)
@@ -171,7 +171,15 @@ static long send_ldap_ber(
                int err;
 
                /* lock the connection */ 
-               ldap_pvt_thread_mutex_lock( &conn->c_mutex );
+               if ( ldap_pvt_thread_mutex_trylock( &conn->c_mutex )) {
+                       ldap_pvt_thread_mutex_unlock( &conn->c_write1_mutex );
+                       ldap_pvt_thread_mutex_lock( &conn->c_write1_mutex );
+                       if ( conn->c_writers < 0 ) {
+                               ret = 0;
+                               break;
+                       }
+                       continue;
+               }
 
                if ( ber_flush2( conn->c_sb, ber, LBER_FLUSH_FREE_NEVER ) == 0 ) {
                        ldap_pvt_thread_mutex_unlock( &conn->c_mutex );