]> git.sur5r.net Git - openldap/commitdiff
Use thread pool for operation threads.
authorMark Valence <mrv@openldap.org>
Wed, 7 Jun 2000 19:27:33 +0000 (19:27 +0000)
committerMark Valence <mrv@openldap.org>
Wed, 7 Jun 2000 19:27:33 +0000 (19:27 +0000)
servers/slapd/connection.c
servers/slapd/daemon.c
servers/slapd/init.c
servers/slapd/proto-slap.h

index a1ef902c2d4de2ee1f3379595e3fec912544ae36..0d2d62bc4f0efd4c799418c54245745281f32e04 100644 (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,
index 524f98b34976bb8fe40cb9b5f8e90bbaacee62b6..dd4e1e9cb9aef3678b171772225d687756c57bbb 100644 (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",
index c8322cb9ea1f86fcda4f3fc0f6a1c4f45b2d1a70..7de52da5a44431d977b9c16583e743fb81188160 100644 (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 );
index c438eacd809fc0d84c841eacaed9bd552518d431..9905e1787c716193985179db86d449fba56f6625 100644 (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;