diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2012-04-20 17:07:24 +0200 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2012-04-20 17:07:24 +0200 |
commit | 81e67ee22942ebdc2fe9d5866d0f94306acf82be (patch) | |
tree | 8c668c18a55552e4a7cdc4b0f64ac1f14bd7b4e9 /pool.c | |
parent | 22be58c7b6afc5d061ee3c78629176f94dfa4d4d (diff) | |
download | pgfuse-81e67ee22942ebdc2fe9d5866d0f94306acf82be.tar.gz pgfuse-81e67ee22942ebdc2fe9d5866d0f94306acf82be.tar.bz2 |
using standard mutex attributes, more portable to old Linux systems
Diffstat (limited to 'pool.c')
-rw-r--r-- | pool.c | 21 |
1 files changed, 1 insertions, 20 deletions
@@ -28,7 +28,6 @@ int psql_pool_init( PgConnPool *pool, const char *conninfo, const size_t max_connections ) { size_t i; - pthread_mutexattr_t attr; int res; pool->conns = (PGconn **)malloc( sizeof( PGconn * ) * max_connections ); @@ -44,25 +43,7 @@ int psql_pool_init( PgConnPool *pool, const char *conninfo, const size_t max_con pool->size = max_connections; - res = pthread_mutexattr_init( &attr ); - if( res < 0 ) { - free( pool->avail ); - free( pool->conns ); - return res; - } - res = pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_ERRORCHECK ); - if( res < 0 ) { - free( pool->avail ); - free( pool->conns ); - return res; - } - res = pthread_mutex_init( &pool->lock, &attr ); - if( res < 0 ) { - free( pool->avail ); - free( pool->conns ); - return res; - } - res = pthread_mutexattr_destroy( &attr ); + res = pthread_mutex_init( &pool->lock, NULL ); if( res < 0 ) { free( pool->avail ); free( pool->conns ); |