mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 00:29:35 -05:00
Fix for systems like AIX where pthread_create creates Detached by default
This commit is contained in:
parent
588b23cd1c
commit
a556140e65
1 changed files with 12 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue