Commit 6f88096e authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Report status of failed pthread_create()

parent 6bd6a7cf
...@@ -115,6 +115,7 @@ connection_activity( ...@@ -115,6 +115,7 @@ connection_activity(
#ifndef HAVE_PTHREAD_DETACH #ifndef HAVE_PTHREAD_DETACH
pthread_attr_t attr; pthread_attr_t attr;
#endif #endif
int status;
struct co_arg *arg; struct co_arg *arg;
unsigned long tag, len; unsigned long tag, len;
long msgid; long msgid;
...@@ -198,9 +199,9 @@ connection_activity( ...@@ -198,9 +199,9 @@ connection_activity(
} }
#ifdef HAVE_PTHREAD_DETACH #ifdef HAVE_PTHREAD_DETACH
if ( pthread_create( &arg->co_op->o_tid, NULL, if ( status = pthread_create( &arg->co_op->o_tid, NULL,
connection_operation, (void *) arg ) != 0 ) { connection_operation, (void *) arg ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "pthread_create failed\n", 0, 0, 0 ); Debug( LDAP_DEBUG_ANY, "pthread_create failed (%d)\n", status, 0, 0 );
} else { } else {
pthread_mutex_lock( &active_threads_mutex ); pthread_mutex_lock( &active_threads_mutex );
active_threads++; active_threads++;
...@@ -221,9 +222,9 @@ connection_activity( ...@@ -221,9 +222,9 @@ connection_activity(
/* POSIX_THREADS or compatible /* POSIX_THREADS or compatible
* This is a draft 10 or standard pthreads implementation * This is a draft 10 or standard pthreads implementation
*/ */
if ( pthread_create( &arg->co_op->o_tid, &attr, if ( status = pthread_create( &arg->co_op->o_tid, &attr,
connection_operation, (void *) arg ) != 0 ) { connection_operation, (void *) arg ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "pthread_create failed\n", 0, 0, 0 ); Debug( LDAP_DEBUG_ANY, "pthread_create failed (%d)\n", status, 0, 0 );
} else { } else {
pthread_mutex_lock( &active_threads_mutex ); pthread_mutex_lock( &active_threads_mutex );
active_threads++; active_threads++;
...@@ -233,9 +234,9 @@ connection_activity( ...@@ -233,9 +234,9 @@ connection_activity(
/* /*
* This is a draft 4 or earlier pthreads implementation * This is a draft 4 or earlier pthreads implementation
*/ */
if ( pthread_create( &arg->co_op->o_tid, attr, if ( status = pthread_create( &arg->co_op->o_tid, attr,
connection_operation, (void *) arg ) != 0 ) { connection_operation, (void *) arg ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "pthread_create failed\n", 0, 0, 0 ); Debug( LDAP_DEBUG_ANY, "pthread_create failed (%d)\n", status, 0, 0 );
} else { } else {
pthread_mutex_lock( &active_threads_mutex ); pthread_mutex_lock( &active_threads_mutex );
active_threads++; active_threads++;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment