]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/daemon.c
Change SLAPD shutdown to do a cond wait on active threads instead
[openldap] / servers / slapd / daemon.c
index 5a33a31e8580ef166d3f809c9fb1a79d8752148b..d97981d4bc26992e2f8cb143cffbdf1177ff4c53 100644 (file)
@@ -393,14 +393,13 @@ slapd_daemon(
        }
 
        close( tcps );
+
        pthread_mutex_lock( &active_threads_mutex );
        Debug( LDAP_DEBUG_ANY,
            "slapd shutting down - waiting for %d threads to terminate\n",
            active_threads, 0, 0 );
        while ( active_threads > 0 ) {
-               pthread_mutex_unlock( &active_threads_mutex );
-               pthread_yield();
-               pthread_mutex_lock( &active_threads_mutex );
+               pthread_cond_wait(&active_threads_cond, &active_threads_mutex);
        }
        pthread_mutex_unlock( &active_threads_mutex );