summaryrefslogtreecommitdiff
path: root/pool.c
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2012-04-20 17:07:24 +0200
committerAndreas Baumann <abaumann@yahoo.com>2012-04-20 17:07:24 +0200
commit81e67ee22942ebdc2fe9d5866d0f94306acf82be (patch)
tree8c668c18a55552e4a7cdc4b0f64ac1f14bd7b4e9 /pool.c
parent22be58c7b6afc5d061ee3c78629176f94dfa4d4d (diff)
downloadpgfuse-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.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/pool.c b/pool.c
index 7f85ae7..4c9d329 100644
--- a/pool.c
+++ b/pool.c
@@ -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 );