]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Fix (I hope) threading issues with DCE Threads.
authorKurt Zeilenga <kurt@openldap.org>
Tue, 10 Nov 1998 19:35:42 +0000 (19:35 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 10 Nov 1998 19:35:42 +0000 (19:35 +0000)
CHANGES
servers/slapd/connection.c
servers/slapd/main.c
servers/slurpd/main.c
servers/slurpd/replica.c

diff --git a/CHANGES b/CHANGES
index 64cec68f6f02decccba39c68736b806847d922b6..3d62a66f6eac4e53db957bd5b501b69dd3223fba 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,15 @@
 OpenLDAP Change Log
 
+Changes included in OpenLDAP Stable 
+       CVS Tag: OPENLDAP_STABLE
+       Fixed DCE Threading issues
+
 Changes included in OpenLDAP Stable 
        CVS Tag: OPENLDAP_STABLE_981105
        Updated manual pages.
        Fixed libldif/line64 bug
+       Fixed slapd/back-passwd sizelimit bug
+       Fixed slapd/filterentry equality bug
 
 Changes included in OpenLDAP Stable 
        CVS Tag: OPENLDAP_STABLE_981027
index 5c3ebdf708f7307d78562dee2c30ceaf4f4e567d..b5daaee6c3e85ac0250cc3d8db8d3888d03215b8 100644 (file)
@@ -203,6 +203,22 @@ connection_activity(
 
        pthread_attr_init( &attr );
        pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
+#if !defined( THREAD_MIT_PTHREADS ) && !defined( THREAD_DCE_PTHREADS )
+       /* POSIX_THREADS or compatible
+        * This is a draft 10 or standard pthreads implementation
+        */
+       if ( pthread_create( &arg->co_op->o_tid, &attr,
+           (void *) connection_operation, (void *) arg ) != 0 ) {
+               Debug( LDAP_DEBUG_ANY, "pthread_create failed\n", 0, 0, 0 );
+       } else {
+               pthread_mutex_lock( &active_threads_mutex );
+               active_threads++;
+               pthread_mutex_unlock( &active_threads_mutex );
+       }
+#else  /* draft 4 */
+       /*
+        * This is a draft 4 or earlier pthreads implementation
+        */
        if ( pthread_create( &arg->co_op->o_tid, attr,
            (void *) connection_operation, (void *) arg ) != 0 ) {
                Debug( LDAP_DEBUG_ANY, "pthread_create failed\n", 0, 0, 0 );
@@ -211,5 +227,6 @@ connection_activity(
                active_threads++;
                pthread_mutex_unlock( &active_threads_mutex );
        }
+#endif /* draft 4 */
        pthread_attr_destroy( &attr );
 }
index 01930b970910c9c1ad6cd9a8bf6939af58baed05..7ea253bdf6db9e4fc2493568765862b27e518fff 100644 (file)
 #include "slap.h"
 #include "ldapconfig.h"
 
-extern void    daemon();
+extern void    slapd_daemon();
 extern int     lber_debug;
 
 extern char Versionstr[];
 
+
 /*
  * read-only global variables or variables only written by the listener
  * thread (after they are initialized) - no need to protect them with a mutex.
  */
-int            ldap_debug;
+int            ldap_debug = 0;
 #ifdef LDAP_DEBUG
 int            ldap_syslog = LDAP_DEBUG_STATS;
 #else
@@ -55,15 +56,12 @@ pthread_mutex_t     num_sent_mutex;
  */
 pthread_mutex_t        entry2str_mutex;
 pthread_mutex_t        replog_mutex;
-#ifndef sunos5
-pthread_mutex_t        regex_mutex;
-#endif
 
 static
 usage( name )
     char       *name;
 {
-       fprintf( stderr, "usage: %s [-d debuglevel] [-f configfile] [-p portnumber] [-s sysloglevel]\n", name );
+       fprintf( stderr, "usage: %s [-d ?|debuglevel] [-f configfile] [-p portnumber] [-s sysloglevel]\n", name );
 }
 
 main( argc, argv )
@@ -105,19 +103,19 @@ main( argc, argv )
                                    LDAP_DEBUG_CONFIG );
                                printf( "\tLDAP_DEBUG_ACL\t\t%d\n",
                                    LDAP_DEBUG_ACL );
-                               printf( "\tLDAP_DEBUG_STATS\t\t%d\n",
+                               printf( "\tLDAP_DEBUG_STATS\t%d\n",
                                    LDAP_DEBUG_STATS );
-                               printf( "\tLDAP_DEBUG_STATS2\t\t%d\n",
+                               printf( "\tLDAP_DEBUG_STATS2\t%d\n",
                                    LDAP_DEBUG_STATS2 );
-                               printf( "\tLDAP_DEBUG_SHELL\t\t%d\n",
+                               printf( "\tLDAP_DEBUG_SHELL\t%d\n",
                                    LDAP_DEBUG_SHELL );
-                               printf( "\tLDAP_DEBUG_PARSE\t\t%d\n",
+                               printf( "\tLDAP_DEBUG_PARSE\t%d\n",
                                    LDAP_DEBUG_PARSE );
                                printf( "\tLDAP_DEBUG_ANY\t\t%d\n",
                                    LDAP_DEBUG_ANY );
                                exit( 0 );
                        } else {
-                               ldap_debug = atoi( optarg );
+                               ldap_debug |= atoi( optarg );
                                lber_debug = (ldap_debug & LDAP_DEBUG_BER);
                        }
                        break;
@@ -184,12 +182,27 @@ main( argc, argv )
                pthread_attr_init( &attr );
                pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
 
-               if ( pthread_create( &listener_tid, attr, (void *) daemon,
+#if !defined( THREAD_MIT_PTHREADS ) && !defined( THREAD_DCE_PTHREADS )
+               /* POSIX_THREADS or compatible
+                * This is a draft 10 or standard pthreads implementation
+                */
+               if ( pthread_create( &listener_tid, &attr, (void *) slapd_daemon,
+                   (void *) port ) != 0 ) {
+                       Debug( LDAP_DEBUG_ANY,
+                           "listener pthread_create failed\n", 0, 0, 0 );
+                       exit( 1 );
+               }
+#else  /* draft 4 */
+               /*
+                * This is a draft 4 or earlier pthreads implementation
+                */
+               if ( pthread_create( &listener_tid, attr, (void *) slapd_daemon,
                    (void *) port ) != 0 ) {
                        Debug( LDAP_DEBUG_ANY,
                            "listener pthread_create failed\n", 0, 0, 0 );
                        exit( 1 );
                }
+#endif /* draft 4 */
                pthread_attr_destroy( &attr );
                pthread_join( listener_tid, (void *) &status );
                pthread_exit( 0 );
index a3b935faa578f384b348171f9122abe6aa06c260..e1e8fa60d5114aedceeeb1be64245860294ce906 100644 (file)
@@ -121,6 +121,21 @@ main(
      * Start the main file manager thread (in fm.c).
      */
     pthread_attr_init( &attr );
+#if !defined( THREAD_MIT_PTHREADS ) && !defined( THREAD_DCE_PTHREADS )
+    /* POSIX_THREADS or compatible
+     * This is a draft 10 or standard pthreads implementation
+     */
+    if ( pthread_create( &(sglob->fm_tid), &attr, (void *) fm, (void *) NULL )
+           != 0 ) {
+       Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n",
+               0, 0, 0 );
+       exit( 1 );
+
+    }
+#else /* draft 4 */
+    /*
+     * This is a draft 4 or earlier pthreads implementation
+     */
     if ( pthread_create( &(sglob->fm_tid), attr, (void *) fm, (void *) NULL )
            != 0 ) {
        Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n",
@@ -128,17 +143,26 @@ main(
        exit( 1 );
 
     }
+#endif /* draft 4 */
     pthread_attr_destroy( &attr );
 
     /*
      * Wait for the fm thread to finish.
      */
+#ifdef POSIX_THREADS
+    pthread_join( sglob->fm_tid, (void *) NULL );
+#else
     pthread_join( sglob->fm_tid, (void *) &status );
+#endif
     /*
      * Wait for the replica threads to finish.
      */
     for ( i = 0; sglob->replicas[ i ] != NULL; i++ ) {
+#ifdef POSIX_THREADS
+       pthread_join( sglob->replicas[ i ]->ri_tid, (void *) NULL );
+#else
        pthread_join( sglob->replicas[ i ]->ri_tid, (void *) &status );
+#endif
     }
     Debug( LDAP_DEBUG_ANY, "slurpd: terminating normally\n", 0, 0, 0 );
     sglob->slurpd_shutdown = 1;
index ed25a629077031feed19d6dee387adaea5b66f1b..1b5c085ad7e7667181e1471b3e9d281a757760df 100644 (file)
@@ -59,6 +59,21 @@ start_replica_thread(
     pthread_attr_init( &attr );
     pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
 
+#if !defined( THREAD_MIT_PTHREADS ) && !defined( THREAD_DCE_PTHREADS )
+    /* POSIX_THREADS or compatible
+     * This is a draft 10 or standard pthreads implementation
+     */
+    if ( pthread_create( &(ri->ri_tid), &attr, (void *) replicate,
+           (void *) ri ) != 0 ) {
+       Debug( LDAP_DEBUG_ANY, "replica \"%s:%d\" pthread_create failed\n",
+               ri->ri_hostname, ri->ri_port, 0 );
+       pthread_attr_destroy( &attr );
+       return -1;
+    }
+#else  /* draft 4 */
+    /*
+     * This is a draft 4 or earlier pthreads implementation
+     */
     if ( pthread_create( &(ri->ri_tid), attr, (void *) replicate,
            (void *) ri ) != 0 ) {
        Debug( LDAP_DEBUG_ANY, "replica \"%s:%d\" pthread_create failed\n",
@@ -66,6 +81,7 @@ start_replica_thread(
        pthread_attr_destroy( &attr );
        return -1;
     }
+#endif /* draft 4 */
     pthread_attr_destroy( &attr );
     return 0;
 }