]> git.sur5r.net Git - openldap/commitdiff
Removed active_threads count and associated mutex/cond. Replaced with
authorMark Valence <mrv@openldap.org>
Sat, 10 Jun 2000 06:40:03 +0000 (06:40 +0000)
committerMark Valence <mrv@openldap.org>
Sat, 10 Jun 2000 06:40:03 +0000 (06:40 +0000)
 ldap_pvt_thread_pool_backload() as needed.  All tests run OK on pthre
ads (linux), cthreads, NT threads, and Pth.

servers/slapd/connection.c
servers/slapd/daemon.c
servers/slapd/init.c
servers/slapd/monitor.c
servers/slapd/proto-slap.h

index 147c7b35114af2843520ac2f230fa2e926383f2b..67d6cd04279d9b797013af5f91bf28b3d5c4189d 100644 (file)
@@ -843,13 +843,6 @@ operations_error:
                }
        }
 
-       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 );
@@ -1135,10 +1128,6 @@ static int connection_op_activate( Connection *conn, Operation *op )
                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 ) {
index 337edd72c9cb6b1fd4ba1c317718e69cc79992d1..93ec33d23cc96c01c34f3a46e7a7966878669d1d 100644 (file)
@@ -751,9 +751,7 @@ slapd_daemon_task(
 
                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;
@@ -1158,16 +1156,11 @@ 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",
-           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;
 }
index 7de52da5a44431d977b9c16583e743fb81188160..0039bdbfde23f1eee6ebc251549d1cc1facfe79a 100644 (file)
@@ -38,9 +38,6 @@ char          **g_argv;
 /*
  * 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;
@@ -99,9 +96,6 @@ slap_init( int mode, const char *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 );
-
                        ldap_pvt_thread_mutex_init( &currenttime_mutex );
                        ldap_pvt_thread_mutex_init( &entry2str_mutex );
                        ldap_pvt_thread_mutex_init( &replog_mutex );
index dbe8dda1ffa523f8043cb068694a5b89c6899fa3..63c791dd587605f981fd0618722ebc9ceb4548ac 100644 (file)
@@ -90,9 +90,7 @@ monitor_info(
        }
        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 );
index 9905e1787c716193985179db86d449fba56f6625..1f4e35217139b9997c8eca88040eda12b8f65a5b 100644 (file)
@@ -726,7 +726,6 @@ LIBSLAPD_F (int)    krbv4_ldap_auth();
 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;
@@ -757,8 +756,6 @@ LIBSLAPD_F (time_t)         starttime;
 
 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;