Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
postgres connection pool: fix race when a connection is already acqui…
…red while pool is still being constructed

(cherry picked from commit 1e96813)
  • Loading branch information
jef-n committed Jun 29, 2015
1 parent 87adfbe commit b97d46c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/providers/postgres/qgspostgresconnpool.cpp
Expand Up @@ -14,14 +14,23 @@
***************************************************************************/

#include "qgspostgresconnpool.h"

#include "qgspostgresconn.h"


QgsPostgresConnPool* QgsPostgresConnPool::instance()
{
static QgsPostgresConnPool sInstance;
return &sInstance;
static QgsPostgresConnPool *sInstance = 0;

if ( !sInstance )
{
static QMutex m;
m.lock();
if ( !sInstance )
sInstance = new QgsPostgresConnPool();
m.unlock();
}

return sInstance;
}

QgsPostgresConnPool::QgsPostgresConnPool() : QgsConnectionPool<QgsPostgresConn*, QgsPostgresConnPoolGroup>()
Expand Down

0 comments on commit b97d46c

Please sign in to comment.