From ef846c91058c66f70b011f860a07c3b239b80579 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 25 Jan 2009 03:04:43 +0000 Subject: [PATCH] More for prev commit --- servers/slapd/result.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 22cfde8688..3ec5021db5 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -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 ); -- 2.39.5