]> git.sur5r.net Git - openldap/commitdiff
Fix prev commit, c_writers check should be mutex'd
authorHoward Chu <hyc@openldap.org>
Thu, 15 Jan 2009 21:22:35 +0000 (21:22 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 15 Jan 2009 21:22:35 +0000 (21:22 +0000)
servers/slapd/connection.c

index f20a0552b487ffd142a6989e9f52a6dbd0f38e69..3169e1018e939ffa416f8430b53a641f5a830566 100644 (file)
@@ -761,8 +761,8 @@ void connection_closing( Connection *c, const char *why )
                connection_abandon( c );
 
                /* wake write blocked operations */
+               ldap_pvt_thread_mutex_lock( &c->c_write1_mutex );
                if ( c->c_writers > 0 ) {
-                       ldap_pvt_thread_mutex_lock( &c->c_write1_mutex );
                        c->c_writers = -c->c_writers;
                        ldap_pvt_thread_cond_broadcast( &c->c_write1_cv );
                        ldap_pvt_thread_mutex_unlock( &c->c_write1_mutex );
@@ -778,6 +778,7 @@ void connection_closing( Connection *c, const char *why )
                        }
                        ldap_pvt_thread_mutex_unlock( &c->c_write1_mutex );
                } else {
+                       ldap_pvt_thread_mutex_unlock( &c->c_write1_mutex );
                        slapd_clr_write( c->c_sd, 1 );
                }