From: Alan T. DeKok Date: Mon, 27 Jul 2015 19:31:46 +0000 (-0400) Subject: Don't do mutexes if no threads X-Git-Tag: release_3_0_10~281 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f50609f9257085bf32ef7e91b9d846e0dba94b6;p=thirdparty%2Ffreeradius-server.git Don't do mutexes if no threads --- diff --git a/src/main/connection.c b/src/main/connection.c index 0c7b120c6e9..4ef03bdf623 100644 --- a/src/main/connection.c +++ b/src/main/connection.c @@ -786,7 +786,9 @@ static void *fr_connection_get_internal(fr_connection_pool_t *pool, bool spawn) if (!pool) return NULL; +#ifdef HAVE_PTHREAD_H if (spawn) pthread_mutex_lock(&pool->mutex); +#endif now = time(NULL); @@ -805,10 +807,6 @@ static void *fr_connection_get_internal(fr_connection_pool_t *pool, bool spawn) * heap and use it. */ if (this) { - /* - * The conection is either fine, or was - * successfully reconnected. - */ fr_heap_extract(pool->heap, this); goto do_return; } @@ -864,7 +862,9 @@ do_return: this->pthread_id = pthread_self(); #endif +#ifdef HAVE_PTHREAD_H if (spawn) pthread_mutex_unlock(&pool->mutex); +#endif DEBUG("%s: Reserved connection (%" PRIu64 ")", pool->log_prefix, this->number);