}
}
- ldap_pvt_thread_mutex_lock( &active_threads_mutex );
- active_threads--;
- if( active_threads < 1 ) {
- ldap_pvt_thread_cond_signal(&active_threads_cond);
- }
- ldap_pvt_thread_mutex_unlock( &active_threads_mutex );
-
connection_resched( conn );
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
free( tmpdn );
}
- ldap_pvt_thread_mutex_lock( &active_threads_mutex );
- active_threads++;
- ldap_pvt_thread_mutex_unlock( &active_threads_mutex );
-
status = ldap_pvt_thread_pool_submit( connection_pool, connection_operation, (void *) arg );
if ( status != 0 ) {
ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
- ldap_pvt_thread_mutex_lock( &active_threads_mutex );
- at = active_threads;
- ldap_pvt_thread_mutex_unlock( &active_threads_mutex );
+ at = ldap_pvt_thread_pool_backload(connection_pool);
#if defined( HAVE_YIELDING_SELECT ) || defined( NO_THREADS )
tvp = NULL;
}
}
- ldap_pvt_thread_pool_destroy(connection_pool, 1);
-
- ldap_pvt_thread_mutex_lock( &active_threads_mutex );
Debug( LDAP_DEBUG_ANY,
"slapd shutdown: waiting for %d threads to terminate\n",
- active_threads, 0, 0 );
- while ( active_threads > 0 ) {
- ldap_pvt_thread_cond_wait(&active_threads_cond, &active_threads_mutex);
- }
- ldap_pvt_thread_mutex_unlock( &active_threads_mutex );
+ ldap_pvt_thread_pool_backload(connection_pool), 0, 0 );
+
+ ldap_pvt_thread_pool_destroy(connection_pool, 1);
return NULL;
}
/*
* global variables that need mutex protection
*/
-int active_threads;
-ldap_pvt_thread_mutex_t active_threads_mutex;
-ldap_pvt_thread_cond_t active_threads_cond;
ldap_pvt_thread_pool_t connection_pool;
ldap_pvt_thread_mutex_t gmtime_mutex;
(void) ldap_pvt_thread_initialize();
ldap_pvt_thread_pool_initialize(&connection_pool, 0, 0);
- ldap_pvt_thread_mutex_init( &active_threads_mutex );
- ldap_pvt_thread_cond_init( &active_threads_cond );
-
ldap_pvt_thread_mutex_init( ¤ttime_mutex );
ldap_pvt_thread_mutex_init( &entry2str_mutex );
ldap_pvt_thread_mutex_init( &replog_mutex );
}
attr_merge( e, "version", vals );
- ldap_pvt_thread_mutex_lock( &active_threads_mutex );
- sprintf( buf, "%d", active_threads );
- ldap_pvt_thread_mutex_unlock( &active_threads_mutex );
+ sprintf( buf, "%d", ldap_pvt_thread_pool_backload(connection_pool) );
val.bv_val = buf;
val.bv_len = strlen( buf );
attr_merge( e, "threads", vals );
LIBSLAPD_F (struct berval **) default_referral;
LIBSLAPD_F (char *) replogfile;
LIBSLAPD_F (const char) Versionstr[];
-LIBSLAPD_F (int) active_threads;
LIBSLAPD_F (int) defsize;
LIBSLAPD_F (int) deftime;
LIBSLAPD_F (int) g_argc;
LIBSLAPD_F (time_t) slap_get_time LDAP_P((void));
-LIBSLAPD_F (ldap_pvt_thread_mutex_t) active_threads_mutex;
-LIBSLAPD_F (ldap_pvt_thread_cond_t) active_threads_cond;
LIBSLAPD_F (ldap_pvt_thread_pool_t) connection_pool;
LIBSLAPD_F (ldap_pvt_thread_mutex_t) entry2str_mutex;