]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Workaround FreeBSD pthread_exit() bug (PR# i386/9237) by cleaning up
authorKurt Zeilenga <kurt@openldap.org>
Wed, 30 Dec 1998 20:43:59 +0000 (20:43 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 30 Dec 1998 20:43:59 +0000 (20:43 +0000)
thread shutdown codes.

CHANGES
servers/slapd/main.c
servers/slurpd/main.c
servers/slurpd/replica.c

diff --git a/CHANGES b/CHANGES
index a3dbced03630076879874f1254802999c33ff7f2..0372b23748632d808ba9db1da97a794b47bd9596 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,8 +4,10 @@ Changes included in OpenLDAP 1.1.2
        CVS Tag: OPENLDAP_REL_ENG_1_1_2
        Fixed slapd schema check bug
        Fixed slapd/back-ldbm/search matched initialization bug
+       Fixed --disable-crypt/-disable-cleartext options
        Fixed misc. overlapping strcpy bugs
        Fixed misc. memory leaks
+       Update slapd/slurpd to workaround FreeBSD pthread_exit bug
 
 Changes included in OpenLDAP 1.1.1
        CVS Tag: OPENLDAP_REL_ENG_1_1_1
index 76f8cd9acd2531fc56283f0c5291e53dc6dc8faf..106617fa06f4924021837f7c4980f52153a1cf35 100644 (file)
@@ -175,44 +175,25 @@ main( int argc, char **argv )
        read_config( configfile, &be, fp );
 
        if ( ! inetd ) {
-               pthread_attr_t  attr;
                int             status;
 
                time( &starttime );
-               pthread_attr_init( &attr );
-#ifdef DETACH_LISTENER_THREAD
-               /* we should detach it if we're going to join with it */
-               pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
-#endif
 
-#if !defined(HAVE_PTHREADS_D4)
-               /* POSIX_THREADS or compatible
-                * This is a draft 10 or standard pthreads implementation
-                */
-               if ( pthread_create( &listener_tid, &attr, slapd_daemon,
+               if ( pthread_create( &listener_tid, NULL, slapd_daemon,
                    (void *) port ) != 0 ) {
                        Debug( LDAP_DEBUG_ANY,
                            "listener pthread_create failed\n", 0, 0, 0 );
                        exit( 1 );
                }
-#else  /* draft4 */
-               /*
-                * This is a draft 4 or earlier pthreads implementation
-                */
-               if ( pthread_create( &listener_tid, attr, slapd_daemon,
-                   (void *) port ) != 0 ) {
-                       Debug( LDAP_DEBUG_ANY,
-                           "listener pthread_create failed\n", 0, 0, 0 );
-                       exit( 1 );
-               }
-#endif /* !draft4 */
-               pthread_attr_destroy( &attr );
+
 #ifdef HAVE_PHREADS_FINAL
                pthread_join( listener_tid, (void *) NULL );
 #else
                pthread_join( listener_tid, (void *) &status );
 #endif
-               pthread_exit( 0 );
+
+               return 0;
+
        } else {
                Connection              c;
                Operation               *o;
index 28a27fc2ffa577edd35f58c3a8b4650bf36557fe..5469454cc715030377e933ce3b578d1e28911f3d 100644 (file)
@@ -112,33 +112,13 @@ main(
     /*
      * Start the main file manager thread (in fm.c).
      */
-    pthread_attr_init( &attr );
-
-#if !defined(HAVE_PTHREADS_D4)
-    /* POSIX_THREADS or compatible
-     * This is a draft 10 or standard pthreads implementation
-     */
-    if ( pthread_create( &(sglob->fm_tid), &attr, fm, (void *) NULL )
+    if ( pthread_create( &(sglob->fm_tid), NULL, fm, (void *) NULL )
            != 0 ) {
        Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n",
                0, 0, 0 );
        exit( 1 );
 
     }
-#else /* !PTHREADS_FINAL */
-    /*
-     * This is a draft 4 or earlier pthreads implementation
-     */
-    if ( pthread_create( &(sglob->fm_tid), attr, fm, (void *) NULL )
-           != 0 ) {
-       Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n",
-               0, 0, 0 );
-       exit( 1 );
-
-    }
-#endif /* !PTHREADS_FINAL */
-
-    pthread_attr_destroy( &attr );
 
     /*
      * Wait for the fm thread to finish.
@@ -160,7 +140,7 @@ main(
     }
     Debug( LDAP_DEBUG_ANY, "slurpd: terminating normally\n", 0, 0, 0 );
     sglob->slurpd_shutdown = 1;
-    pthread_exit( 0 );
 
+       return 0;
 #endif /* !NO_THREADS */
 }
index 41861617a0827d59227b1c6b27171cc3d24915fb..7ccd356a15f33150411684ae415237c8fc5643b5 100644 (file)
@@ -54,38 +54,13 @@ start_replica_thread(
     Ri *ri
 )
 {
-    pthread_attr_t     attr;
-
-    pthread_attr_init( &attr );
-#ifdef NOTDEF
-       /* if main wants to join with us, we shouldn't detach */
-    pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
-#endif
-
-#if !defined(HAVE_PTHREADS_D4)
-    /* POSIX_THREADS or compatible
-     * This is a draft 10 or standard pthreads implementation
-     */
-    if ( pthread_create( &(ri->ri_tid), &attr, 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  /* !final */
-    /*
-     * This is a draft 4 or earlier pthreads implementation
-     */
-    if ( pthread_create( &(ri->ri_tid), attr, replicate,
+    /* POSIX_THREADS or compatible */
+    if ( pthread_create( &(ri->ri_tid), NULL, 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;
     }
-#endif /* !final */
 
-    pthread_attr_destroy( &attr );
     return 0;
 }