From: Mark Valence Date: Wed, 7 Jun 2000 19:27:33 +0000 (+0000) Subject: Use thread pool for operation threads. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2714 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7ec6a4363f5e6c948255581545381647d43bdc96;p=openldap Use thread pool for operation threads. --- diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index a1ef902c2d..0d2d62bc4f 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -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, diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 524f98b349..dd4e1e9cb9 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -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", diff --git a/servers/slapd/init.c b/servers/slapd/init.c index c8322cb9ea..7de52da5a4 100644 --- a/servers/slapd/init.c +++ b/servers/slapd/init.c @@ -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 ); diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index c438eacd80..9905e1787c 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -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;