]> git.sur5r.net Git - openldap/commitdiff
Add tool-threads config keyword, init thread pool in tool mode.
authorHoward Chu <hyc@openldap.org>
Thu, 27 Oct 2005 09:29:42 +0000 (09:29 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 27 Oct 2005 09:29:42 +0000 (09:29 +0000)
servers/slapd/bconfig.c
servers/slapd/init.c
servers/slapd/proto-slap.h

index ea679bad6e82aae6400cb92eb9a533a4b139a368..8b66270c0f315ce39b1227ee7584fca07078d113 100644 (file)
@@ -163,6 +163,7 @@ enum {
        CFG_SASLSECP,
        CFG_SSTR_IF_MAX,
        CFG_SSTR_IF_MIN,
+       CFG_TTHREADS,
 
        CFG_LAST
 };
@@ -570,6 +571,9 @@ static ConfigTable config_back_cf_table[] = {
 #endif
                "( OLcfgGlAt:77 NAME 'olcTLSDHParamDir' "
                        "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
+       { "tool-threads", "count", 2, 2, 0, ARG_INT|ARG_MAGIC|CFG_TTHREADS,
+               &config_generic, "( OLcfgGlAt:80 NAME 'olcToolThreads' "
+                       "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
        { "ucdata-path", "path", 2, 2, 0, ARG_IGNORED,
                NULL, NULL, NULL, NULL },
        { "updatedn", "dn", 2, 2, 0, ARG_DB|ARG_DN|ARG_QUOTE|ARG_MAGIC,
@@ -628,6 +632,7 @@ static ConfigOCs cf_ocs[] = {
                 "olcTLSCACertificatePath $ olcTLSCertificateFile $ "
                 "olcTLSCertificateKeyFile $ olcTLSCipherSuite $ olcTLSCRLCheck $ "
                 "olcTLSRandFile $ olcTLSVerifyClient $ olcTLSDHParamDir $ "
+                "olcToolThreads $ "
                 "olcObjectIdentifier $ olcAttributeTypes $ olcObjectClasses $ "
                 "olcDitContentRules ) )", Cft_Global },
        { "( OLcfgGlOc:2 "
@@ -700,6 +705,9 @@ config_generic(ConfigArgs *c) {
                case CFG_THREADS:
                        c->value_int = connection_pool_max;
                        break;
+               case CFG_TTHREADS:
+                       c->value_int = slap_tool_thread_max;
+                       break;
                case CFG_SALT:
                        if ( passwd_salt )
                                c->value_string = ch_strdup( passwd_salt );
@@ -909,6 +917,7 @@ config_generic(ConfigArgs *c) {
                /* single-valued attrs, no-ops */
                case CFG_CONCUR:
                case CFG_THREADS:
+               case CFG_TTHREADS:
                case CFG_RO:
                case CFG_AZPOLICY:
                case CFG_DEPTH:
@@ -1022,6 +1031,11 @@ config_generic(ConfigArgs *c) {
                        connection_pool_max = c->value_int;     /* save for reference */
                        break;
 
+               case CFG_TTHREADS:
+                       ldap_pvt_thread_pool_maxthreads(&connection_pool, c->value_int);
+                       slap_tool_thread_max = c->value_int;    /* save for reference */
+                       break;
+
                case CFG_SALT:
                        if ( passwd_salt ) ch_free( passwd_salt );
                        passwd_salt = c->value_string;
index ab5f17b7a72cdeca721a9ff64d37b98e92e571c4..6a68e498eec835b3128163c3f5bb387582ebcedc 100644 (file)
@@ -67,6 +67,7 @@ struct berval NoAttrs = BER_BVC( LDAP_NO_ATTRS );
  */
 ldap_pvt_thread_pool_t connection_pool;
 int                    connection_pool_max = SLAP_MAX_WORKER_THREADS;
+int            slap_tool_thread_max = 1;
 #ifndef HAVE_GMTIME_R
 ldap_pvt_thread_mutex_t        gmtime_mutex;
 #endif
@@ -124,8 +125,6 @@ slap_init( int mode, const char *name )
 
        switch ( slapMode & SLAP_MODE ) {
        case SLAP_SERVER_MODE:
-               ldap_pvt_thread_pool_init( &connection_pool,
-                               connection_pool_max, 0);
 
                /* FALLTHRU */
        case SLAP_TOOL_MODE:
@@ -136,6 +135,9 @@ slap_init( int mode, const char *name )
 
                slap_name = name;
 
+               ldap_pvt_thread_pool_init( &connection_pool,
+                               connection_pool_max, 0);
+
                ldap_pvt_thread_mutex_init( &entry2str_mutex );
                ldap_pvt_thread_mutex_init( &replog_mutex );
 
index d9c0ab24364788408a9ac528d5aa7687f2c5b58e..b4cea81cf1121a4c00e913e39afea064f1d6513a 100644 (file)
@@ -1734,6 +1734,7 @@ LDAP_SLAPD_V (time_t)             starttime;
 
 LDAP_SLAPD_V (ldap_pvt_thread_pool_t)  connection_pool;
 LDAP_SLAPD_V (int)                     connection_pool_max;
+LDAP_SLAPD_V (int)                     slap_tool_thread_max;
 
 LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) entry2str_mutex;
 LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) replog_mutex;