mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-02-17 14:00:30 +08:00
Changes prompted by Terry's patches
This commit is contained in:
parent
97e88afb5e
commit
e4af28135d
@ -203,22 +203,10 @@ connection_activity(
|
||||
|
||||
pthread_attr_init( &attr );
|
||||
pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
|
||||
#ifdef PTHREAD_MUTEX_INITIALIZER
|
||||
/*
|
||||
#ifndef THREAD_MIT_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 /* !PTHREAD_MUTEX_INITIALIZER*/
|
||||
/*
|
||||
* 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 );
|
||||
@ -227,6 +215,18 @@ connection_activity(
|
||||
active_threads++;
|
||||
pthread_mutex_unlock( &active_threads_mutex );
|
||||
}
|
||||
#endif /* !PTHREAD_MUTEX_INITIALIZER*/
|
||||
#else /* !THREAD_MIT_PTHREAD */
|
||||
/*
|
||||
* 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 );
|
||||
} else {
|
||||
pthread_mutex_lock( &active_threads_mutex );
|
||||
active_threads++;
|
||||
pthread_mutex_unlock( &active_threads_mutex );
|
||||
}
|
||||
#endif /* !THREAD_MIT_PTHREAD */
|
||||
pthread_attr_destroy( &attr );
|
||||
}
|
||||
|
@ -185,27 +185,27 @@ main( argc, argv )
|
||||
pthread_attr_init( &attr );
|
||||
pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
|
||||
|
||||
#ifdef PTHREAD_MUTEX_INITIALIZER
|
||||
/*
|
||||
#ifndef THREAD_MIT_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 /* !PTHREAD_MUTEX_INITIALIZER */
|
||||
/*
|
||||
* 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 /* !PTHREAD_MUTEX_INITIALIZER */
|
||||
#else /* !THREAD_MIT_PTHREADS */
|
||||
/*
|
||||
* 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 /* !THREAD_MIT_PTHREADS */
|
||||
pthread_attr_destroy( &attr );
|
||||
pthread_join( listener_tid, (void *) &status );
|
||||
pthread_exit( 0 );
|
||||
|
@ -59,21 +59,10 @@ start_replica_thread(
|
||||
pthread_attr_init( &attr );
|
||||
pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
|
||||
|
||||
#ifdef PTHREAD_MUTEX_INITIALIZER
|
||||
/*
|
||||
#ifndef THREAD_MIT_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 /* !PTHREAD_MUTEX_INITIALIZER */
|
||||
/*
|
||||
* 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",
|
||||
@ -81,7 +70,18 @@ start_replica_thread(
|
||||
pthread_attr_destroy( &attr );
|
||||
return -1;
|
||||
}
|
||||
#endif /* !PTHREAD_MUTEX_INITIALIZER */
|
||||
#else /* !THREAD_MIT_PTHREADS */
|
||||
/*
|
||||
* 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",
|
||||
ri->ri_hostname, ri->ri_port, 0 );
|
||||
pthread_attr_destroy( &attr );
|
||||
return -1;
|
||||
}
|
||||
#endif /* !THREAD_MIT_PTHREADS */
|
||||
pthread_attr_destroy( &attr );
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user