]> git.sur5r.net Git - openldap/commitdiff
More for ITS#6853, check for trickle thread not yet started
authorHoward Chu <hyc@openldap.org>
Wed, 16 Mar 2011 17:30:24 +0000 (17:30 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 16 Mar 2011 17:30:24 +0000 (17:30 +0000)
servers/slapd/back-bdb/tools.c

index 18bbeeeb3543063b6bf36c66557c0f8a52e4a7aa..735845e4590736cff256b1d563d60e127605c67a 100644 (file)
@@ -162,6 +162,12 @@ int bdb_tool_entry_close(
                slapd_shutdown = 1;
 #ifdef USE_TRICKLE
                ldap_pvt_thread_mutex_lock( &bdb_tool_trickle_mutex );
+
+               /* trickle thread may not have started yet */
+               while ( !bdb_tool_trickle_active )
+                       ldap_pvt_thread_cond_wait( &bdb_tool_trickle_cond_end,
+                                       &bdb_tool_trickle_mutex );
+
                ldap_pvt_thread_cond_signal( &bdb_tool_trickle_cond );
                while ( bdb_tool_trickle_active )
                        ldap_pvt_thread_cond_wait( &bdb_tool_trickle_cond_end,
@@ -1256,6 +1262,7 @@ bdb_tool_trickle_task( void *ctx, void *ptr )
 
        ldap_pvt_thread_mutex_lock( &bdb_tool_trickle_mutex );
        bdb_tool_trickle_active = 1;
+       ldap_pvt_thread_cond_signal( &bdb_tool_trickle_cond_end );
        while ( 1 ) {
                ldap_pvt_thread_cond_wait( &bdb_tool_trickle_cond,
                        &bdb_tool_trickle_mutex );