From: Howard Chu Date: Thu, 11 May 2000 09:51:24 +0000 (+0000) Subject: Fix for systems like AIX where pthread_create creates Detached by default X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~3008 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a556140e659619947690147bb98486023ffa1d76;p=openldap Fix for systems like AIX where pthread_create creates Detached by default --- diff --git a/libraries/libldap_r/thr_posix.c b/libraries/libldap_r/thr_posix.c index 1a6810c525..61e405584e 100644 --- a/libraries/libldap_r/thr_posix.c +++ b/libraries/libldap_r/thr_posix.c @@ -81,8 +81,19 @@ ldap_pvt_thread_create( ldap_pvt_thread_t * thread, void *(*start_routine)( void * ), void *arg) { - int rtn = pthread_create( thread, LDAP_PVT_THREAD_ATTR_DEFAULT, + int rtn; +#if defined(HAVE_PTHREADS_FINAL) && defined(PTHREAD_CREATE_UNDETACHED) + pthread_attr_t attr; + + pthread_attr_init(&attr); + if (!detach) + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED); + + rtn = pthread_create( thread, &attr, start_routine, arg ); +#else + rtn = pthread_create( thread, LDAP_PVT_THREAD_ATTR_DEFAULT, start_routine, arg ); +#endif if( detach ) { #ifdef HAVE_PTHREADS_FINAL