Use thread pool for operation threads.

This commit is contained in:
Mark Valence 2000-06-07 19:27:33 +00:00
parent 33f4955c07
commit 7ec6a4363f
4 changed files with 6 additions and 2 deletions

View file

@ -1138,8 +1138,7 @@ static int connection_op_activate( Connection *conn, Operation *op )
active_threads++;
ldap_pvt_thread_mutex_unlock( &active_threads_mutex );
status = ldap_pvt_thread_create( &arg->co_op->o_tid, 1,
connection_operation, (void *) arg );
status = ldap_pvt_thread_pool_submit( connection_pool, connection_operation, (void *) arg );
if ( status != 0 ) {
Debug( LDAP_DEBUG_ANY,

View file

@ -1162,6 +1162,8 @@ slapd_daemon_task(
}
}
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",

View file

@ -41,6 +41,7 @@ char **g_argv;
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;
#ifdef SLAPD_CRYPT
@ -96,6 +97,7 @@ slap_init( int mode, const char *name )
slap_name = name;
(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 );

View file

@ -759,6 +759,7 @@ 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;
LIBSLAPD_F (ldap_pvt_thread_mutex_t) replog_mutex;