From c9a86dd1813b03aff74808035f7cae18133e2cbb Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Thu, 3 Aug 2023 10:43:46 +0200 Subject: added THREAD_ID helper in a util.h, done away with warnings on numerical thread systems --- pool.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pool.c') diff --git a/pool.c b/pool.c index 82b0644..f83af07 100644 --- a/pool.c +++ b/pool.c @@ -16,6 +16,7 @@ */ #include "pool.h" +#include "util.h" /* common project utilities */ #include /* for strlen, memcpy, strcmp */ #include /* for ENOENT and friends */ @@ -96,7 +97,7 @@ int psql_pool_destroy( PgConnPool *pool ) break; case USED: syslog( LOG_ERR, "Destroying pool connection to thread %p which is still in use", - pool->thread[i] ); + (void *)pool->thread[i] ); PQfinish( pool->conns[i] ); break; case ERROR: @@ -124,7 +125,7 @@ PGconn *psql_pool_acquire( PgConnPool *pool ) res = pthread_mutex_lock( &pool->lock ); if( res < 0 ) { syslog( LOG_ERR, "Locking mutex failed for thread %p: %d", - pthread_self( ), res ); + THREAD_ID, res ); return NULL; } @@ -146,7 +147,7 @@ PGconn *psql_pool_acquire( PgConnPool *pool ) res = pthread_cond_wait( &pool->cond, &pool->lock ); if( res < 0 ) { syslog( LOG_ERR, "Error waiting for free condition in thread %p: %d", - pthread_self( ), res ); + THREAD_ID, res ); (void)pthread_mutex_unlock( &pool->lock ); return NULL; } -- cgit v1.2.3-54-g00ecf